Allow wxPython object methods to be called from any thread.
Project description
wxAnyThread: allow methods on wxPython objects to be called from any thread
In wxPython, methods that alter the state of the GUI are only safe to call from
the thread running the main event loop. Other threads must typically post
events to the GUI thread instead of invoking methods directly.
This module provides an easy way to invoke wxPython object methods safely
from any thread. Basically, the standard event-based solution is wrapped
into a decorator named "anythread", which can be applied to methods to make
them safe to call from any thread, like so:
class MyFrame(wx.Frame):
@anythread
def ShowFancyStuff():
...does some GUI manipulation...
The ShowFancyStuff method can now be directly invoked from any thread.
The calling thread will block while the main GUI thread performs the method,
and will then receive a return value or exception as appropriate.
In wxPython, methods that alter the state of the GUI are only safe to call from
the thread running the main event loop. Other threads must typically post
events to the GUI thread instead of invoking methods directly.
This module provides an easy way to invoke wxPython object methods safely
from any thread. Basically, the standard event-based solution is wrapped
into a decorator named "anythread", which can be applied to methods to make
them safe to call from any thread, like so:
class MyFrame(wx.Frame):
@anythread
def ShowFancyStuff():
...does some GUI manipulation...
The ShowFancyStuff method can now be directly invoked from any thread.
The calling thread will block while the main GUI thread performs the method,
and will then receive a return value or exception as appropriate.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wxAnyThread-0.1.1.tar.gz
(2.2 kB
view details)
Built Distribution
wxAnyThread-0.1.1-py2.5.egg
(4.4 kB
view details)
File details
Details for the file wxAnyThread-0.1.1.tar.gz
.
File metadata
- Download URL: wxAnyThread-0.1.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | caeba3cddc090927aad32b7b7d03c7d76da57aed856483e68529a2681085bcfd |
|
MD5 | 14a5842e18109a93e8e83bc73e61b6cc |
|
BLAKE2b-256 | ff2aaf772bc1686b5748444f7e69c969b7c8d2606953cbe5835f82ed098f6605 |
File details
Details for the file wxAnyThread-0.1.1-py2.5.egg
.
File metadata
- Download URL: wxAnyThread-0.1.1-py2.5.egg
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f601e027965fbfcdd7cd15199a0595efc2273b7bd009a690a2dae9e103732ac |
|
MD5 | 9734daf6aafcf2c53068d11c9c044a6a |
|
BLAKE2b-256 | a7886e108b427ac380f381d6907db8c1d019e5ef52c2f49ec54426954a58fce4 |