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: Forwarding events and Tk.mainloop problem
Type: Stage:
Components: Tkinter Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: loewis Nosy List: loewis, mkiever
Priority: normal Keywords:

Created on 2006-05-05 11:15 by mkiever, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
testevent.py mkiever, 2006-05-05 11:15 example script
Messages (3)
msg28431 - (view) Author: Matthias Kievernagel (mkiever) * Date: 2006-05-05 11:15
(Python 2.4.1, tcl/tk 8.4 on Linux)

I try to create a widget class (Frame2 in the example)
containing a Listbox.
This should report an event '<<ElementSelect>>'
when the Listbox produces '<<ListboxSelect>>'
or when the selection changes using the Up/Down keys.
(see example script)

Binding '<<ElementSelect>>' to the Frame2 widget
produces the following traceback when the
event is generated:

------------------
listbox select
event generated
Traceback (most recent call last):
  File "testevent.py", line 98, in ?
    tk.mainloop ()
  File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", 
line 965, in mainloop
    self.tk.mainloop(n)
  File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", 
line 1349, in __call__
    self.widget._report_exception()
  File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", 
line 1112, in _report_exception
    root = self._root()
AttributeError: Tk instance has no __call__ method
-----------------

So Tkinter tries to report an exception
caused by the event, but fails to do so
by a second exception in _report_exception.
(not quite sure I did understand this)
The first exception may be a problem with
my code or tcl/tk but at least the second
is a problem of Tkinter.

If you bind '<<ElementSelect>>' to Tk itself
the example works fine.
msg28432 - (view) Author: Matthias Kievernagel (mkiever) * Date: 2007-01-19 15:43
I just found the time to re-investigate my reported bug
and found out that it is due to a subclassing error
of my own (redefine of Misc._root()).
Sorry, for the false report.
Can someone delete/reject or shoot it down?

Greetings,
Matthias Kievernagel
msg28433 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-01-19 23:44
Closing as invalid, as requested.
History
Date User Action Args
2022-04-11 14:56:17adminsetgithub: 43323
2006-05-05 11:15:20mkievercreate