[Tkinter-discuss] Lazy updating of image data in ttk widgets
Bob Greschke
bob at passcal.nmt.edu
Fri Mar 8 18:24:33 CET 2013
Happens on
Python 2.7.2 (default, Jul 18 2011, 14:33:20)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2
TclVersion 8.5 TkVersion 8.5
with the program running on the above and the output being X'ed to an OSX Mountain Lion iMac.
I just have to mouse over the ttk button and it changes (even if, for example, Mail.app has the display focus). When I mouse over the buttons they get slightly lighter color while the cursor is on them (the 'activebackground' color?)
Same with
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
>>> import Tkinter
>>> Tkinter.TclVersion
8.5
>>> Tkinter.TkVersion
8.5
on my iMac. Just running the mouse cursor over the button makes it change. No activebackground color change on Mac.
Bob
>>>
On 2013-03-08, at 09:52, Michael Lange <klappnase at web.de> wrote:
> 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
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
More information about the Tkinter-discuss
mailing list