I am trying to summon a Popup menu with the tkinter python GUI toolkit on Mac OS X. This works just fine on Windows, but throws this TclError on Mac OS X. I have ActiveTcl 8.6 installed on the machine. All the other GUI elements (so far) have worked just fine. Do you guys have any ideas how to fix this? The traceback is below.
Exception in Tkinter callback
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1487, in __call__
return self.func(*args)
File "gui.py", line 57, in popup
self.menu.post(event.x_root, event.y_root)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 2778, in post
self.tk.call(self._w, 'post', x, y)
_tkinter.TclError
Referring to this SO post , you can fix this by binding the menu to a Frame or Tk object. Something like:
self.config(menu=self.menu)
if self
is your root window.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.