Tkinter in thread hangs on windows but not on Linux

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philippe C. Martin

    Tkinter in thread hangs on windows but not on Linux

    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(threadi ng.Thread):
    __m_smg = None
    __m_title = None
    def __init__(self,p _msg,p_title):
    threading.Threa d.__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=T OP, 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
    Secure the right domain name for your business or website today. Custom tailored payment plans available to fit any budget.

    *************** ************

  • Kamilche

    #2
    Re: Tkinter in thread hangs on windows but not on Linux

    This example worked for me on Windows 2000, after inserting

    import threading
    from Tkinter import *
    import ScrolledText


    at the top.

    Comment

    • Philippe C. Martin

      #3
      Re: Tkinter in thread hangs on windows but not on Linux

      Well this is what is on the top of my script:
      from Tkinter import *
      import threading
      from ScrolledText import *

      I still hang under XP .... wish I had 2K to test.

      I almost sounds like tkinter does not get refresh events anymore.

      I'll keep at it







      On Tue, 18 Jan 2005 12:42:21 -0800, Kamilche wrote:
      [color=blue]
      > This example worked for me on Windows 2000, after inserting
      >
      > import threading
      > from Tkinter import *
      > import ScrolledText
      >
      >
      > at the top.[/color]

      Comment

      • Philippe C. Martin

        #4
        Re: Tkinter in thread hangs on windows but not on Linux

        Actually, the following link:
        We recently reorganized our site, so the page you are looking for may have moved. Please look for it in the navigation menu, site map, or site search.  You can also contact us and we'll help you out.  Thanks for your patience.

        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:
        [color=blue]
        > 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(threadi ng.Thread):
        > __m_smg = None
        > __m_title = None
        > def __init__(self,p _msg,p_title):
        > threading.Threa d.__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=T OP, 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()
        >
        >
        > .
        > .
        > .[/color]

        Comment

        Working...