On 2/15/07, Baptiste Carvello <baptiste13 at altern.org> wrote: > >> Ah, threads :-( It turns out that you need to invoke GetMessage in the > >> context of the thread in which the window was created. In a different > >> thread, you won't get any messages. > > > > I'd be interested to hear about other situations where threading would > > cause a problem. My suspicion is that Windows is the hard one, and as > > I've shown that one is solvable. > > > > > I've tried something similar on Linux, with gtk an wx. > > You can run the gtk main loop in its own thread, but because gtk is not thread > safe, you have to grab a mutex everytime you run gtk code outside the thread the > mainloop is running in. So you have to surround your calls to the gtk api with > calls to gtk.threads_enter and gtk.threads_leave. Except for callbacks of > course, because they are executed in the main thread... Doable, but not fun. > > The same goes for wx. Then all hell breaks loose when you try to use both gtk > and wx at the same time. That's because on Linux, the wx main loop calls the gtk > mainloop behind the scenes. As far as I know, that problem can not be solved > from python. > > So yes that strategy can work, but it's no silver bullet. And it's worse on Windows and Mac OS X where some GUI API calls *must* happen on a particular thread or they simply don't work. -bob
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4