473,614 Members | 2,268 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.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
http://www.codebykevin.com
Jul 11 '07 #1
2 3953
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.
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
4188
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++ syntax in the main wxWindows documentation. It also says that the samples will help, but I can't seem to make sense of them. Should I just use a not-as-good GUI like Tkinter or a not-as-common one like Anygui or PyUI if I want to have documentation?...
25
2607
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 trees, using.. b) a hopefully dead-sexy gui, all in order to... c) eventually pump out certain bits of the datastructure over the network in semi-realtime (< 10ms accuracy or so).
7
11895
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 wxPython. Mitchell Timin -- "Many are stubborn in pursuit of the path they have chosen, few in
21
2364
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 fixed fonts, or at least anything that looks better on a small laptop screen. TkInter seems much easier to use... less effort to do things.
15
2897
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 to be more low-level than the other GUI toolkits I've used (Tk, GTK, and Trestle), and there are all sorts exposed details in wxWindows/wxPython that I find weird.
25
3340
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 Python GUI toolkit is that Tkinter was there first." - Guido van Rossum Guess, that answers my question, but isn't "Tkinter was there first" a very bad answer? :) It is kinda ugly too, so I wonder why it can't be replaced? Or maybe another GUI...
8
4481
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 happen to already own John Grayson's book about Tkinter programming, so that is rather handy if I decide to use Tkinter. I have done some things slightly more involved than "Hello World" in Tkinter - I have never used wxPython. So, basically the...
9
3251
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 wx.Gauge in GUI during the process. for src in urls: downloader = Downloader( src, destination, GUI ) downloader.start()
16
2387
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 in particular, but I am curious to know why some people find it "ugly" or "bad" or whatever. It has its own bugs and missing features, of course, but it is one of the major GUI player in the arena, together with PyQt and PyGTK.
0
8180
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8623
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8576
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8429
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7091
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6088
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4050
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4121
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2566
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 we have to send another system

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.