PyQt, Cannot send events to objects owned by a different thread?
david at boddie.org.uk
Sun Nov 25 17:24:02 CET 2007
On Sun Nov 25 15:22:24 CET 2007, Alexander Tuchacek wrote:
> i try to adress an qt object
> self.statusbar.showMessage("rtt %s...." % (n.rtt))
> in an callback function, comming from a shared lib importet by ctypes, on
> osx this works wonderfull
> when i run the same code on linux (ubuntu gutsy), i get this core dump, ok,
> i understand that the problem is, that i cant speak to the qt thread, but
> why does it work on osx?
Maybe the implementation of the library is different on OS X. You need to
give us more enough information to work with.
> shall i recompile python? pyqt or sip? without threads?
> could somebody give me a hint what to do best? how can i call a qt object in
> an c-lib callback?
You can either construct some sort of event handling mechanism or use signals
and slots. Personally, I'd use signals and slots for this, if possible.
The idea would be to set up a connection between your callback code and
the status bar's showMessage() slot. Then you would only have to emit that
signal to update the status bar.
More information about the Python-list