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] Le
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
"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 a
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 w
"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_call
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,
"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 cod
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,
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 langu
"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 give
On Sat, Dec 29, 2007 at 04:58:39PM +0100, Michael Bernhard Arp S?rensen wrote:
> 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?
>
In Python, any object that can be *called* can be con
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 imidi
"Michael Bernhard Arp Sørensen" <[EMAIL PROTECTED]>
wrote
> I want to learn about callbacks because we use it at work in our
> software.
Can you be more specific about what you want to know. Callbacks are
used in many different ways from event handling methods in a GUI
to network programming t
rently)
##
- Original Message -
From: "Michael Bernhard Arp Sørensen" <[EMAIL PROTECTED]>
To:
Sent: Saturday, December 29, 2007 10:58 AM
Subject: [Tutor] Learning about callbaks
Hi there.
I want to learn about callbacks because we use it at
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.
___
15 matches
Mail list logo