Tkinter in thread hangs on windows but not on Linux

Philippe C. Martin philippe at philippecmartin.com
Tue Jan 18 19:18:44 EST 2005


Actually, the following link:
http://www.astro.washington.edu/owen/TkinterSummary.html
seems to say my code is illegal - so I'm now just launching a modless
window from the main thread - _seems_ to work




On Tue, 18 Jan 2005 11:45:28 +0100, Philippe C. Martin wrote:

> Hi,
> 
> I need to pop-up in a "modless" manner some windows from an existing
> Tkinter loop. The following code works OK under Linux: the second window
> opens, shows the information, and quits cleanly when destroyed. However,
> under windows, I get the second window without the content (so I hang in
> run I guess), and both the thread and the calling process hang.
> 
> Any clue ?
> 
> Thanks
> Philippe
> 
> 
> 
> 
> 
> #*******************************************************************************
> class SC_DOCS(threading.Thread):
>   __m_smg = None
>   __m_title = None
>   def __init__(self,p_msg,p_title):
>     threading.Thread.__init__(self)
>     self.__m_msg = p_msg
>     self.__m_title = p_title
> 
> #*******************************************************************************
>   def run (self):
>     l_r = Tk()
>     l_r.title(self.__m_title)
>     l_f = Frame(l_r)
>     l_f.pack(side=TOP, expand=YES, fill=BOTH)
>     l_st = ScrolledText(l_f)
>     l_st.pack(side=TOP, expand=YES, fill=BOTH)
>     l_st.insert(END,self.__m_msg)
> 
>     l_r.mainloop()
> 
> 
> .
> .
> .
> 
> l_d = SC_DOCS('A MESSAGE', 'A TITLE')
> l_d.start()
> 
> 
> .
> .
> .




More information about the Python-list mailing list