On Fri, 8 Mar 2013 10:24:33 -0700
Bob Greschke <b...@passcal.nmt.edu> wrote:

> 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.
> 
(...)
> 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

Ok, then it is at least not a bug specific for my version of Tk.

Experimenting a little I just found that it is possible to update the
image programatically if I force tk to redraw the button e.g. with this
modification of my example:

def test(event=None):
    im.configure(data=icon2)
    b.config(state=b['state'])

root.bind('<F1>', test)

It also works with b.config(image=b['image']) or
b.config(text=b['text']). Hmmm...

Another try, I changed my example callback into:

s = ttk.Style()
def test(event=None):
    im.configure(data=icon2)
    s.theme_use(s.theme_use())

root.bind('<F1>', test)

Here this works too, and this one might actually be usable!
Can you confirm that this does the trick?

Regards

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Without facts, the decision cannot be made logically.  You must rely on
your human intuition.
                -- Spock, "Assignment: Earth", stardate unknown
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to