This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_ttk_guionly assertion error on 3.x linux 64-bit
Type: behavior Stage: resolved
Components: Tests, Tkinter Versions: Python 3.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gpolo Nosy List: gpolo, loewis, srid
Priority: normal Keywords: buildbot, patch

Created on 2010-03-22 21:11 by srid, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg101533 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-03-22 21:11
This happens on 3.1.2 Linux 64-bit.

test test_ttk_guionly failed -- Traceback (most recent call last):
  File "/home/apy/rrun/tmp/autotest/apy/lib/python3.1/tkinter/test/test_ttk/test_widgets.py", line 708, in test_traversal
    self.assertEqual(self.nb.select(), str(self.child2))
AssertionError: '.183072530064' != '.183072529552'
msg102606 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-04-08 09:40
I can reproduce the problem. The root cause is that the "event generate .nb <Control-Tab>" simply does not have any effect - neither through Python, nor through directly wish. Nor do any of the other keys that supposedly cycle through the notebook, when send through "event generate". Typing them directly works fine.

Guilherme, any idea?
msg102616 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2010-04-08 12:55
> Martin v. Löwis added the comment:
>
> I can reproduce the problem. The root cause is that the "event generate .nb <Control-Tab>" simply does not have any effect - neither through Python, nor through directly wish. Nor do any of the other keys that supposedly cycle through the notebook, when send through "event generate". Typing them directly works fine.
>

Could it be caused because the notebook is not focused at the correct
time ? Here in OSX (finally I have one of these) I had to add
self.nb.focus() before that event_generate.

The attached patch is for trunk.
msg102617 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-04-08 13:08
> Could it be caused because the notebook is not focused at the correct
> time ? Here in OSX (finally I have one of these) I had to add
> self.nb.focus() before that event_generate.

No, that doesn't help. The event still gets lost. In particular, running

ttk::notebook .nb
.nb add [label .nb.l1 -text hello] -text a
.nb add [label .nb.l2 -text world] -text b
pack .nb
focus .nb
puts [.nb select]
event generate .nb <Key-Right>
puts [.nb select]

in wish prints ".nb.l1" twice; pressing the right key at the end of the
script does cycle properly, though.
msg102619 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2010-04-08 14:38
When I run that alone I get the same effect, maybe there is something
else contributing to the previous result I saw.

focus_force did solve when testing it alone, and I think it is ok to
use focus_force when testing at least.
Here is the sample I tried:

import ttk
import Tkinter as tk

nb = ttk.Notebook()
nb.add(tk.Label(text='hi'), text='a')
nb.add(tk.Label(text='there'), text='b')

nb.pack()
nb.wait_visibility()

nb.focus_force()
print nb.select()
nb.event_generate('<Key-Right>')
print nb.select()
msg102634 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-04-08 17:39
Thanks for the advice. I managed to fix this (for me) in r79907; I had to force focus before every single event :-(
History
Date User Action Args
2022-04-11 14:56:58adminsetgithub: 52451
2010-04-08 17:39:27loewissetstatus: open -> closed
messages: + msg102634

keywords: + buildbot
resolution: fixed
stage: resolved
2010-04-08 14:40:45gpolosetfiles: - p1.diff
2010-04-08 14:38:24gpolosetmessages: + msg102619
2010-04-08 13:08:02loewissetmessages: + msg102617
2010-04-08 12:55:37gpolosetfiles: + p1.diff
keywords: + patch
messages: + msg102616
2010-04-08 09:40:54loewissetassignee: gpolo

messages: + msg102606
nosy: + gpolo, loewis
2010-03-22 21:11:06sridcreate