how to link two classes
Adonis
deltapigz at telocity.com
Sat Aug 3 14:06:31 EDT 2002
i have two classes, one is inheriting asyncore.dispatcher, the other is
inheriting model.Background(PythonCardPrototype), and i wish to be able to
be able to call PythonCard from asyncore, but PythonCard initiates itself
through a function and not (explicitly)?
here is the code, its incomplete, just to get the idea.
any help would greatly be appreciated.
Adonis
-- paste --
class PYCHAT_GUI(model.Background):
def on_openBackground(self, event):
pass
'''def _postMSG(self, data): # i wish to call this from asyncore
..do something..'''
class PYCHAT_SOCKET(asyncore.dispatcher):
buffer = ''
def __init__(self, ip, port):
asyncore.dispatcher.__init__(self)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
self.connect((ip, port))
'''PYCHAT_GUI._postMSG(something)''' # i wish to call it from
anywhere here
def PyChat_StartApp():
_pychSock = PYCHAT_SOCKET('irc.lightning.net', 6667) '''but both have
their own loops
asyncore.loop() and are not
stored in a variable
so i am unable
to call each of the
if __name__ == '__main__': classes.'''
threading.Thread(target=PyChat_StartApp).start()
app = model.PythonCardApp(PYCHAT_GUI)
app.MainLoop()
More information about the Python-list
mailing list