wxPython vs. Tkinter event loops

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Walzer

    #1

    wxPython vs. Tkinter event loops

    I'm porting a Tkinter application to wxPython and had a question about
    wxPython's event loop.

    The Tkinter app provides a GUI to a command-line tool. It gathers user
    input, and opens an asynchronous pipe to the external tool via
    os.popen(). Then, it dumps the output from the external process into a
    text display. Although threads are often recommended for use with GUI
    apps, I am able to keep the GUI responsive with Tkinter's event loop,
    i.e. with regular calls to self.update(); I am still able to update the
    GUI as needed. When I tried the same functions using threads, I noticed
    no measurable improvement in application responsiveness or performance.
    Thus, the application currently runs in a single thread and is updated
    via Tkinter's event loop only.

    Does wxPython's event loop function as smoothly as Tkinter's with an
    asynchronous process, i.e. is the wx.UpdateUIEven t() class analogous to
    Tkinter.update( ), or are threads absoutely essential to keeping a wx GUI
    updated with a long-running background process?
    --
    Kevin Walzer
    Code by Kevin

  • Chris Mellon

    #2
    Re: wxPython vs. Tkinter event loops

    On 7/11/07, Kevin Walzer <kw@codebykevin .comwrote:
    I'm porting a Tkinter application to wxPython and had a question about
    wxPython's event loop.
    >
    The Tkinter app provides a GUI to a command-line tool. It gathers user
    input, and opens an asynchronous pipe to the external tool via
    os.popen(). Then, it dumps the output from the external process into a
    text display. Although threads are often recommended for use with GUI
    apps, I am able to keep the GUI responsive with Tkinter's event loop,
    i.e. with regular calls to self.update(); I am still able to update the
    GUI as needed. When I tried the same functions using threads, I noticed
    no measurable improvement in application responsiveness or performance.
    Thus, the application currently runs in a single thread and is updated
    via Tkinter's event loop only.
    >
    Does wxPython's event loop function as smoothly as Tkinter's with an
    asynchronous process, i.e. is the wx.UpdateUIEven t() class analogous to
    Tkinter.update( ),
    No. It provides a totally different purpose - it's an idle event thats
    used to do things like ensure that menu items and toolbar buttons are
    kept in sync.
    >or are threads absoutely essential to keeping a wx GUI
    updated with a long-running background process?
    No again. wxPython provides a Process class for executing external
    applications and providing events in response to input, app exit, and
    similar. You can also implement it in a similar way to your Tkinter
    implementation, but backwards - poll the pipe repeatedly using
    wx.CallAfter or wx.CallLater calls.

    Comment

    • star.public@gmail.com

      #3
      Re: wxPython vs. Tkinter event loops

      On Jul 11, 11:17 am, "Chris Mellon" <arka...@gmail. comwrote:
      No again. wxPython provides a Process class for executing external
      applications and providing events in response to input, app exit, and
      similar. You can also implement it in a similar way to your Tkinter
      implementation, but backwards - poll the pipe repeatedly using
      wx.CallAfter or wx.CallLater calls.
      You can also set up a callback on the idle event and do a little
      processing every time it's called, though that can be odd because it
      tends to e.g. update more often when the mouse is moving over the
      window and such. There may be other ways, too, I don't have access to
      my docs or the demo here (just poked my head in because I'm waiting
      for my work program to stop being frozen ...).

      -Weaver

      Comment

      Working...