Re: Twisted an UI's?

You probably want to find and use a threadsafe queue, put the Twisted reactor on one thread, put WX on the other, and communicate back and forth.  I know WX has a way to call  a function in the message loop in a threadsafe manner, and Twisted might offer the same.  This is common enough that there's lots of higher level things for it, and "thread pool for async networking library x because this thing over here blocks and I need it to run in the background" is a thing that's so commonly available that we get to take it for granted these days, so you can probably just find a package and use it, if it's not already built in.  But, two things:

First, Twisted is beyond archaic, you probably want to use asyncio or gevent or any of the more modern options.  If this is a game even just using asynchat or asyncore would probably be fine, and quite possibly easier, since games don't really play nice with this idea of long promise chains.  I know your example isn't a game, but this is a game forum, so it's worth noting.

Second, it doesn't matter for the client side unless this thing is moving a lot of data, blocking the event loop a little bit because you needed to pump the wx event loop is, mostly, whatever.  The main problem is just getting both event loops to stop promptly.  But you don't need to be so concerned about this.  For something like a chat client, having the client not check the network for 200ms because UI won't even show up.  You have to get the server right, but that's not hard because the server isn't doing UI.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : BoundTo via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : redfox via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : BoundTo via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : BoundTo via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector

Reply via email to