Tkinter in thread hangs on windows but not on Linux

Philippe C. Martin philippecmartin at sbcglobal.net
Tue Jan 18 05:45:28 EST 2005


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


.
.
.
-- 
***************************
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***************************




More information about the Python-list mailing list