how to link two classes

Adonis deltapigz at
Sat Aug 3 20:06:31 CEST 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.


-- paste --

class PYCHAT_GUI(model.Background):
    def on_openBackground(self, event):

    '''def _postMSG(self, data):    # i wish to call this from asyncore something..'''

class PYCHAT_SOCKET(asyncore.dispatcher):

    buffer = ''

    def __init__(self, ip, port):
        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('', 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.'''
    app = model.PythonCardApp(PYCHAT_GUI)

More information about the Python-list mailing list