so if you do compile that way, Tk is thread safe, I can have separate
mainloops in different threads and they can all post to each others
windows, etc?

On Fri, 2008-10-24 at 17:45 -0200, Guilherme Polo wrote:

> On Fri, Oct 24, 2008 at 5:31 PM, Allen Taylor
> <[EMAIL PROTECTED]> wrote:
> > Hi Guilherme,
> > The versions of Python and Tk used are the default packages installed on
> > Linux (Ubuntu 6.06 LTS). I don't know whether the default install is
> > compiled with --enable-threads or not. So, mtTkinter seems to be handy if
> > you want to use the default installed packages?
> > Allen
> >
> 
> To check for --enable-threads try this:
> 
> import Tkinter
> Tkinter.Tk().getvar("tcl_platform(threaded)")
> 
> You will either get 1, or a TclError.
> 
> Also, I though you said latest tcl/tk versions but clearly tcl/tk
> packages in Ubuntu 6.06 are not the latest.
> But they also won't make a difference if you didn't recompile python
> with these packages, I'm just telling this because right now Ubuntu
> includes tcl/tk 8.5 but distributes python-tk compiled against tcl/tk
> 8.4.
> 
> Maybe you could include one example where this new module makes a
> difference ? We could be talking about different things. For instance,
> this:
> 
> import Tkinter
> 
> def test(text_widget):
>     text_widget.config(text='abcdef')
> 
> def try_it(text_widget):
>     threading.Thread(target=test, args=(text_widget, )).start()
> 
> lbl = Tkinter.Label()
> lbl.pack()
> lbl.after(10, lambda: try_it(lbl))
> 
> lbl.mainloop()
> 
> Would crash if tcl/tk were not compiled with --threads-enabled, but
> then using your module it will run just fine.
> 
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to