[Pyobjc-dev] Python thread and pyobjc? (help)
Brought to you by:
ronaldoussoren
From: whamoo <wh...@rk...> - 2005-01-26 10:45:35
|
Hi to all, I'm trying to write a simple mud client (a simple telnet client), but i have some problem with python thread and cocoa. I launch my app, but no result and when i call sendcommand_() my app enter in a infinite loop that freeze my app.... Some idea? Thanks a lot =) ------------ from PyObjCTools import NibClassBuilder, AppHelper import telnetlib import thread import time import telnet NibClassBuilder.extractClasses("MainMenu") # class defined in MainMenu.nib class mud(NibClassBuilder.AutoBaseClass): # the actual base class is NSObject # The following outlets are added to the class: # inputField # mainText # sendButt # win conn = None def sendcommand_(self, sender): com = self.inputField.stringValue() self.conn.sendtxt("com") def applicationWillFinishLaunching_(self, aNotification): self.conn = telnetlib.Telnet("an host", a port) thread.start_new_thread(self.getmud, ()) def getmud(self): while 1: txt = "" txt = self.conn.read_eager() if txt != "": self.mainText.setString_(txt) if __name__ == "__main__": AppHelper.runEventLoop() Whamoo www.rknet.it Powered by: - MacOsX - Gnu / Linux Debian Sarge - Amiga Os 3.9 - Milk |