Hello folks,
I'm having an issue with mixing wxPython and threading ... I realize
multi-threading always introduces subtle bugs, but the following
scenario is just odd:
I start a dummy thread, that does nothing but increment a counter and
print its value to the screen, then afterwards, I start the wxPython
application. I get nothing but weird behavior: sometimes the gui just
crashes, sometimes I get an exception, sometimes it runs for a little
but very slowly ...
Anyone know whats going on? I have a dual-core T5500, so multi
threading is piece of cake for it hardware -wise.
Cheers,
--Shafik 3 1607
On 10/4/07, Shafik <sh******@gmail .comwrote:
Hello folks,
I'm having an issue with mixing wxPython and threading ... I realize
multi-threading always introduces subtle bugs, but the following
scenario is just odd:
I start a dummy thread, that does nothing but increment a counter and
print its value to the screen, then afterwards, I start the wxPython
application. I get nothing but weird behavior: sometimes the gui just
crashes, sometimes I get an exception, sometimes it runs for a little
but very slowly ...
Anyone know whats going on? I have a dual-core T5500, so multi
threading is piece of cake for it hardware -wise.
That's quite a broad and poorly specified problem to ask people to
solve with no code. You get double minus points for mentioning an
exception without saying what it was.
Below is a script that has no demonstrable problems on my machine:
import wx
import threading
if __name__ == '__main__':
run = True
def count():
counter = 0
while run:
print counter
counter += 1
thread = threading.Threa d(target=count)
thread.start()
app = wx.App(False)
f = wx.Frame(None)
f.Show()
app.MainLoop()
run = False
Since the counter loop spins tightly, this causes some CPU contention
and could quite possibly cause a non-trivial GUI to respond poorly,
but that's to be expected.
Since the observed behaviour is clearly undefined,
I forgive you for the poorly specified behaviour
description: asking for a close description of random
behaviour is just ridiculous.
The most obvious point is that wx is not re-entrant
or thread safe: you have to make it so by using
wx.CallAfter()
Since you are talking about a bug in your screen
display while using a screen library, it would
also be interesting it you described the environment:
Which operating system? Which windowing system?
Which wx library? Which Python? Which IDE? What code?
[david]
Shafik wrote:
Hello folks,
I'm having an issue with mixing wxPython and threading ... I realize
multi-threading always introduces subtle bugs, but the following
scenario is just odd:
I start a dummy thread, that does nothing but increment a counter and
print its value to the screen, then afterwards, I start the wxPython
application. I get nothing but weird behavior: sometimes the gui just
crashes, sometimes I get an exception, sometimes it runs for a little
but very slowly ...
Anyone know whats going on? I have a dual-core T5500, so multi
threading is piece of cake for it hardware -wise.
Cheers,
--Shafik
>
The real goal is to start the gui in a different thread, and have the
main thread regain control. That seems like a feasible thing to be
able to do, though I have been unsuccessful ... if anyone would like
to suggest something without being covertly insulting, I'm all ears.
AFAIK some toolkits take it personally if they don't run in THE thread,
meaning the main-thread. No idea if that applies to your situation, but
as you continue to being vague, so are the answers.
Diez This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Doug Farrell |
last post by:
Hi all,
I just installed the wxPython-2.4.1.2 demo RPM on my RedHat Linux 9.0
machine, which has Python 2.2.2 on it, and I'm having a problem
running the demo.py program. Here is a trace of the results:
python demo.py
The font "-*-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1,
-*-arial-medium-r-normal--12-*-*-*-*-*-iso8859-1,
-*-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-15,
|
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.
|
by: fooooo |
last post by:
This is a network app, written in wxPython and the socket module. This
is what I want to happen:
GUI app starts. User clicks a button to 'start' the work of the app.
When start is pressed, a new thread is spawned (threading module) and
this thread starts listening for data on a socket. When someone
connects, a new thread is spawned, It needs to do I/O on that socket
and open a GUI window so the user can communicate with the client...
|
by: rob_sas |
last post by:
I have two Windows Services that log the error 'The <service> service hung on starting'. (EventID 7022) int the System Log of Event Viewer. A few seconds later, they both log the message 'Service started successfully' in the Application Log of Event Viewer.
This only happens on bootup. It doesn't happen when I stop/start the service after bootup.
I read somewhere that this can happen when the .NET libraries take too long to load (> 30...
|
by: David Van D |
last post by:
Hi there,
A few weeks until I begin my journey towards a degree in Computer
Science at Canterbury University in New Zealand,
Anyway the course tutors are going to be teaching us JAVA wth bluej and
I was wondering if anyone here would be able to give me some tips for
young players such as myself, for learning the language.
Is this the best Newsgroup for support with JAVA?
| |
by: cyberco |
last post by:
In my wxPython app a non-GUI thread (that reads info from the network)
tries to open a frame to show the new info. This results in my app
hanging (which is not too surprising). Coming from a C# environment I
wonder if there is some sort of delegate mechanism in wxPython to do
this sort of thing.
2B
|
by: [david] |
last post by:
What am I doing wrong?
I'm trying to capture stdErr in a multi-threaded program.
This code crashes wxPython with
/Py Assertion Error: C++ assertion "m_count=-1 || m_count=-2" failed/
What I'm trying to do is redirect stderr and stdout to a wxPython text
control.
In an ideal world, when the worker thread crashes, I should get a stderr
message, with no effect on the main thread.
|
by: Okonita |
last post by:
Hi all,
I have gone through the process of installing DB2 UDBv9 Express-C in
my local linux environment. I am used to having icon placed on my
Desktop or taskbar for easy access to (db2cc) Control Center. After
installation, how then can I get access to DB2? How can I place a
desktop icon in linux for easy access to DB2?
Can anyone recommend a book (free or not)that takes a Linux newbie
through the nitty-gritty of Linux and Db2?
|
by: joedeene |
last post by:
ok, i have a question, can you run a console application directly from bootup on the system, like set the boot order to cd for first and have a console application on the cd and it will come up. if not what kind of programming language will compile an application to run directly at boot order on the computer not operating system. for example a program like partition magic, doesnt need an operating system to partition the selected drive. i only...
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |