[Tutor] Learning about callbaks

Michael Bernhard Arp Sørensen michaelarpsorensen at stevnstrup.dk
Wed Jan 2 12:48:11 CET 2008

Greetings, my master.

I think you need to strip back and simplify, it looks like
> you may have been reading too many different resources
> and incorporated some ideas without really understanding
> what they do and why.

I'm humbled by your insight. This is absolutely true.

I did some research, reading and test last night and I finally got it
working. There was a missing bit that I needed to understand, and suddenly I
saw the light. :-) In a manner of speaking. I wrote this piece of code:

class UserInput:
    def __init__(self):
    def test_callback(self, this_callback):
        print "testing the callback"

class Game:
    def __init__(self):
        self.ui = UserInput()
    def hello(self):
        print "hello world"
    def useUI(self):

g = Game()

I wanted to understand how a "parent" object could send a callback to a
"child" object, and now I got it.

Feel free to comment on this, please.

Thank you for your patience, Alan.

Med venlig hilsen/Kind regards

Michael B. Arp Sørensen
Programmør / BOFH
I am /root and if you see me laughing you better have a backup.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080102/04cc89fd/attachment.htm 

More information about the Tutor mailing list