New submission from Nikolay Fomichev <[email protected]>:
A simple code:
class App():
def __init__(self):
self.root = tk.Tk()
self.btn = tk.Button(self.root, text='Click me')
self.btn.pack()
self.btn.bind('<Button-1>', self.click)
self.root.mainloop()
def click(self, event):
# Messagebox or filedialog
pass
When the button is clicked, it calls the function where a filedialog or
messagebox is called. After the function is done the button changes - it looks
like it's pressed. Its relief is sunken. Something like
"self.btn.config(relief=tk.RAISED)" has no effect - relief is raised, but the
button still looks pressed.
If no dialogs are called, all is fine.
But... if instead of "bind" I use config option "command", it works - the
function goes well with dialogs, etc and the button is really raised.
I checked this in 2.6.6, 2.7, 3.1.2 and 3.2 on Linux and Win, everywhere is the
same tune.
----------
components: Tkinter
messages: 129990
nosy: Nikolay.Fomichev
priority: normal
severity: normal
status: open
title: Tkinter, callback functions
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue11387>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com