Re: [Tutor] Learning about callbaks

2008-01-02 Thread Michael Bernhard Arp Sørensen
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,

Re: [Tutor] Learning about callbaks

2008-01-02 Thread Alan Gauld
Michael Bernhard Arp Sørensen [EMAIL PROTECTED] wrote I did some research, reading and test last night and I finally got it working. Sorry, but you didn't! However you are very nearly there... class UserInput: def __init__(self): pass def test_callback(self, this_callback):

Re: [Tutor] Learning about callbaks

2008-01-02 Thread Michael Bernhard Arp Sørensen
Hi again. On Jan 2, 2008 2:25 PM, Alan Gauld [EMAIL PROTECTED] wrote: I did some research, reading and test last night and I finally got it working. Sorry, but you didn't! However you are very nearly there... Darn. :-( I've read what to wrote about the *parentheses*. I see why I was

Re: [Tutor] Learning about callbaks

2008-01-02 Thread Alan Gauld
Michael Bernhard Arp Sørensen [EMAIL PROTECTED] wrote I've read what to wrote about the *parentheses*. I see why I was wrong in my premature assumption. but I fail to understand why it did work. I suspect that if you look closely you'll find that the testing print statement came after the

Re: [Tutor] Learning about callbaks

2008-01-02 Thread Michael Bernhard Arp Sørensen
Hi. On Jan 2, 2008 6:36 PM, Alan Gauld [EMAIL PROTECTED] wrote: Can you modify the program *without modifying the classes* to use an ordinary function as the callback? Say this goodbye function: def goodbye(): print goodbye world This should not require more than 5 lines of new code

Re: [Tutor] Learning about callbaks

2008-01-02 Thread ALAN GAULD
Yes, exactly like that. Well done, you are now callback aware :-) Alan G. - Original Message From: Michael Bernhard Arp Sørensen [EMAIL PROTECTED] To: Alan Gauld [EMAIL PROTECTED] Cc: tutor@python.org Sent: Wednesday, 2 January, 2008 8:19:23 PM Subject: Re: [Tutor] Learning about

Re: [Tutor] Learning about callbaks

2008-01-01 Thread Michael Bernhard Arp Sørensen
Greetings, my masters. This is somewhat difficult to transfer to my program with 2 classes/objects. All examples I've seen is not for more than one instance of a single object. I use more than one class in my program. I have a game class and a menu class. When the user chooses quit in the menu,

Re: [Tutor] Learning about callbaks

2008-01-01 Thread Alan Gauld
Michael Bernhard Arp Sørensen [EMAIL PROTECTED] wrote I have a game class and a menu class. When the user chooses quit in the menu, I want the menu object to call a method that executes a quit_program() from the game class. self.game.quit_program() should do it. Except in your code bekow

Re: [Tutor] Learning about callbaks

2007-12-30 Thread Alan Gauld
Michael Bernhard Arp Sørensen [EMAIL PROTECTED] wrote Greetings, my master. Nah, there are no masters on the tutor list, we are all learning together, just at different stages. If you really want the masters go to comp.lang.python! :-) I'm writing a game based on curses. OK, That gives us

Re: [Tutor] Learning about callbaks

2007-12-30 Thread Tiago Saboga
On Sun, Dec 30, 2007 at 09:17:42AM -, Alan Gauld wrote: Yes, the Python tutor list is one of the best features of Python. This expresses exactly the way I feel about python. Everytime I have to work in another language, I keep asking myself: but where is the tutor mailing list for this

[Tutor] Learning about callbaks

2007-12-29 Thread Michael Bernhard Arp Sørensen
Hi there. I want to learn about callbacks because we use it at work in our software. I there a short hello world-like version of a callback example? -- 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.

Re: [Tutor] Learning about callbaks

2007-12-29 Thread Michael Bernhard Arp Sørensen
Greetings, my master. I'm writing a game based on curses. I have my own screen object and several child objects to handle sub windows with e.g. menues, board/map/views and log outputs. All user input is done with screen.getch and later sent to the dynamic menu for selecting menu points. My