473,503 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PyQt and async I/O

djw
Greetings-

I was looking at the ASPN recipe for async I/O and Tkinter:

http://aspn.activestate.com/ASPN/Coo...n/Recipe/82965

I am interested in using the recipe that is provided in the comments section
for PyQt courtesy of Laura Creighton.

I have a question though....

In the code, it says:

"One important thing to remember is that the thread has to yield
control."

That appears in this code (the thread that will contain the async I/O):

def workerThread1(self):
"""
This is where we handle the asynchronous I/O. For example, it may be
a 'select()'.
One important thing to remember is that the thread has to yield
control.
"""
while self.running:
# To simulate asynchronous I/O, we create a random number at
# random intervals. Replace the following 2 lines with the real
# thing.
time.sleep(rand.random() * 0.3)
msg = rand.random()
self.queue.put(msg)
If you were to use asyncore for this async I/O, there is no yielding that I
can see. Select() doesn't yield, and there is no time.sleep() in the
asyncore.loop() code. Even if I were to add a time.sleep() to the loop,
wouldn't the fact that select() blocks for some timeout value (default=30.0
sec) imply that it would only yield after the select() timed out each time
through the loop? That would seem to make for a pretty unresponsive UI.

Hopefully somebody can clue me into understanding this.

Thanks,

Don

Jul 18 '05 #1
1 3760
On Tue, Jul 01, 2003 at 02:01:43PM -0700, djw wrote:
[...]

If you were to use asyncore for this async I/O, there is no yielding that I
can see. Select() doesn't yield, and there is no time.sleep() in the
asyncore.loop() code. Even if I were to add a time.sleep() to the loop,
wouldn't the fact that select() blocks for some timeout value (default=30.0
sec) imply that it would only yield after the select() timed out each time
through the loop? That would seem to make for a pretty unresponsive UI.

Hopefully somebody can clue me into understanding this.


Twisted has support for Qt -- see the 'twisted.internet.qtreactor' module.
That might give you some ideas; alternatively, you could just use Twisted
and stop worrying ;)

-Andrew.
Jul 18 '05 #2

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

Similar topics

10
2833
by: Ilya Knizhnik | last post by:
Dear All, I am fairly new to Python. I have found it an easy language to learn and a very usefull one for many tasks. Currently I am working on a python project that involves a GUI and it was...
35
7716
by: Vamsi Mudrageda | last post by:
I am kind of new to Python, and after trying and using wxPython, I found it kind of lacking in easy-to-read documentation, speed at loading, and GUI response-time. So I am looking for an another...
8
4838
by: simo | last post by:
OK, so I'm at the stage where I want to make a choice between wxPython and PyQt. Currently I'm using wxPython mainly due to the fact that it has GPL Linux and Windows versions. I prefer Qt to...
10
2183
by: svenn.are | last post by:
Hi, I wanted to run a program that is written in PyQt on my mac, and went over to Riverbank to get PyQ 3.13 and SIP 4.1.1 sources. I followed the installation guide except for the compiling...
3
2059
by: Fabio | last post by:
Hi all, I'm about to write an application, and I'd like to use PyQt, but before choosing this toolkit I would like to clarify some particular licensing issues; if some user has already touched...
10
2133
by: Simon John | last post by:
After quite a while of wxPython I'm getting back into PyQt, mainly due to the announcement by Trolltech that they will make a GPL version of Qt4 for Windows (and Phil-T said he will make a PyQt to...
4
2195
by: Phil Thompson | last post by:
Riverbank Computing is pleased to announce the release of PyQt v3.14 available from http://www.riverbankcomputing.co.uk/. Changes since the last release include support for QScintilla v1.5. ...
17
11802
by: eholbroo | last post by:
I've narrowed down my toolkit selection for my project to wxPython and pyQt, and now i'd like to hear any opinions, war stories, peeves, etc, about them, particularly from anyone who's used...
3
2061
by: Phil Thompson | last post by:
Riverbank Computing is pleased to announce the release of PyQt v4.0beta1 available from http://www.riverbankcomputing.co.uk/pyqt/. PyQt is a comprehensive set of Qt bindings for the Python...
0
7201
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
7328
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
6988
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
7456
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...
1
5011
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...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3166
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...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
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.