Hi,
I noticed that image data in ttk widgets seem to be updated only when the
widget receives keyboard focus or the mouse pointer enters the widget.
A simple example of what I mean:
#####################################################################
import Tkinter
import ttk
icon1 = ('R0lGODlhFQANAMIAAJaWlu/v7////wAAAP///////////////yH5BAEAAA'
'QALAAAAAAVAA0AAANACLqsQTDCRsOTUYnNucUZIAwDRwofSGhk2aIXq'
'I1tCauruL1bKus1mw/DOr2GkqKphAx1ns0JwEKtRlfWbAyTAAA7')
icon2 = ('R0lGODlhFQANAKEAAJaWlu/v7////////yH5BAEAAAMALAAAAAAVAA0AAA'
'IyhI8Ww80Jw3LNiIuxpBXkv3GD9WkTR5ZCiHrqelJpycquWjszGOs33'
'etIhsRcpYgMMgoAOw==')
root = Tkinter.Tk()
im = Tkinter.PhotoImage(data=icon1)
b = ttk.Button(image=im, text='ttk.Button', compound='left')
b.pack(padx=100, pady=30)
b2 = Tkinter.Button(image=im, text='Tkinter.Button', compound='left')
b2.pack(padx=100, pady=30)
root.bind('<F1>', lambda event: im.configure(data=icon2))
root.mainloop()
#####################################################################
When I start this and press F1, the icon in the Tkinter button is updated
immediately (as expected), the image in the ttk button only when I <Tab>
into the button or put the mouse pointer into the widget.
The system here is debian squeeze, Tk-8.5.8 .
Can anyone confirm this behavior, and is there any known workaround?
Regards
Michael
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
After a time, you may find that "having" is not so pleasing a thing,
after all, as "wanting." It is not logical, but it is often true.
-- Spock, "Amok Time", stardate 3372.7
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss