[wxPython] " thread" vs. "threading" modules?

G'day all,

I note that the threading demo uses the lower-level "thread" module rather
than the "threading" module... of course, the demo isn't actually doing much
so that's probably more appropriate, but I just wanted to check that the
latter module doesn't present problems when used with wxPython...?

I played around with threading for part of my [rather large by now...]
application about a year ago, before the addition of multi-thread support to
wxWindows, with very limited success (a euphemism for "not really much
success at all"!), and would like to re-code certain time-consuming sections
to use multiple threads, particularly for use on not-so-fast machines... and
I'd like to use "threading" rather than "thread" (although I guess that's
not absolutely necessary...). Will there be problems with this?

Cheerio, Chris

···

-------------------------------------------------------------------------
Chris Fama <mailto:Chris.Fama@uq.net.au> Phone:(07) 3870 5639
Brisbane, Australia Mobile:(0400) 833 700
-------------------------------------------------------------------------
Do not be anxious about anything, but in everything, by prayer and
thanksgiving, present your requests to God. And the peace of God,
which transcends all understanding, will fill your hearts and your
minds through Christ Jesus. Phillipians 4:6-7 (NIV)

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users

Chris Fama writes:

G'day all,

I note that the threading demo uses the lower-level "thread" module rather
than the "threading" module... of course, the demo isn't actually doing much
so that's probably more appropriate, but I just wanted to check that the
latter module doesn't present problems when used with wxPython...?

Python's `threading' module is implemented with Python code, using the
`thread' module, so it's probably safe.
Anything that it could do you break wxPython, you could (and probably
would) do with your own code, if you tried to implement the same
functionality;)

···

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users

I'm using the threading module extensively with wxPython with perfect
results.

Keep in mind that in general it is a good idea to have only one GUI thread.
That is, you should do all window related coding in the main thread, and
don't even touch a window with any other threads. This is due to the fact
that the underlying GUI systems are not generally thread-safe. With the
right strategy, this is not as much a problem as it may appear.

You will most likely want your other threads to affect the GUI. The best
way to accomplish this is indirectly, through a Queue. Your non-GUI threads
put commands in a queue and your GUI thread processes these commands in
OnIdle. The form that the "commands" take is up to you.

- Ken Seehof

···

----- Original Message -----
From: "Joshua Rosen" <rozzin@geekspace.com>
To: <wxpython-users@lists.sourceforge.net>
Sent: Sunday, November 12, 2000 8:19 AM
Subject: Re: [wxPython] "thread" vs. "threading" modules?

Chris Fama writes:

> G'day all,
>
> I note that the threading demo uses the lower-level "thread" module

rather

> than the "threading" module... of course, the demo isn't actually doing

much

> so that's probably more appropriate, but I just wanted to check that the
> latter module doesn't present problems when used with wxPython...?

Python's `threading' module is implemented with Python code, using the
`thread' module, so it's probably safe.
Anything that it could do you break wxPython, you could (and probably
would) do with your own code, if you tried to implement the same
functionality;)
_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users