472,327 Members | 1,155 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,327 software developers and data experts.

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.UpdateUIEvent() 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
http://www.codebykevin.com
Jul 11 '07 #1
2 3845
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.UpdateUIEvent() 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.
Jul 11 '07 #2
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

Jul 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Daniel Ehrenberg | last post by:
I'm trying to learn wxPython, but I can't seem to find much documentation. The wxPython website says that all advanced (and even some basic)...
25
by: James Goldwater | last post by:
I'm starting a new hopfully-commercial project soon, and I face a dilemma about whether Python with wxPython would be appropriate. The project...
7
by: SeeBelow | last post by:
Do many people think that wxPython should replace Tkinter? Is this likely to happen? I ask because I have just started learning Tkinter, and I...
21
by: j_mckitrick | last post by:
Just thought I'd play devil's advocate... I tried wxPython briefly, and it had some nice features. It has a huge list of dependencies. I...
15
by: Grant Edwards | last post by:
Can anybody recommend a good book on wxPython? Are there any books on wxPython? I've been trying to learn wxPython and/or wax for a few weeks,...
25
by: BJörn Lindqvist | last post by:
See: http://www.wxpython.org/quotes.php. especially: "wxPython is the best and most mature cross-platform GUI toolkit, given a number of...
8
by: Erik Johnson | last post by:
I am looking for some input on GUI libraries. I want to build a Python-driven GUI, but don't really understand the playing field very well. I have...
9
by: perchef | last post by:
Hi, I have several files to download and a GUI to update. I know this is a frequently asked question but i can't find an appropriate solution....
16
by: Andrea Gavana | last post by:
Hi Diez & All, Do you mind explaining "why" you find it *buttugly*? I am asking just out of curiosity, obviously. I am so biased towards...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.