473,511 Members | 14,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3944
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
4184
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) documentation for wxPython is only available in C++...
25
2590
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 has 3 main areas: a) manipulation of lists and...
7
11882
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 wonder if I should abandon it in favor of...
21
2342
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 don't like the fonts (but I'd love to know how to get...
15
2883
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, and I'm just not getting it. wxWindows seems...
25
3321
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 constraints. The only reason wxPython isn't the standard...
8
4468
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 generally heard good things about wxPython. I...
9
3247
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. My Downloader extends threading.Thread and update a...
16
2367
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 wxPython that I won't make any comment on this thread...
0
7251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7148
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7089
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.