On May 6, 3:07 pm, Carl Banks wrote:
> I'm going to guess that you want the keyboardHandler to call method of
> commandHandler. There's no reason for commandHandler to be a handler
> at all then: keyboardHandler is already handling it.
Thanks Carl, you've got it right and your following exampl
On May 5, 12:17 pm, George Oliver wrote:
> A handler would be something like a key input handler. The key input
> handler is defined separately from the command handler in the case I
> want to use a different method of input, for example a mouse or
> joystick.
>
> In the dictionary of key inputs I
On May 5, 7:55 pm, Dave Angel wrote:
> George Oliver wrote:
> > On May 5, 11:59 am, Dave Angel wrote:
>
> >> 1) forget about getattr() unless you have hundreds of methods in your
> >> map. The real question is why you need two maps. What good is the
> >> "command string" doing you? Why not jus
George Oliver wrote:
On May 5, 11:59 am, Dave Angel wrote:
1) forget about getattr() unless you have hundreds of methods in your
map. The real question is why you need two maps. What good is the
"command string" doing you? Why not just map the keyvalues directly
into function objects?
On Tue, 05 May 2009 16:52:39 +0100, George Oliver
wrote:
hi, I'm a Python beginner with a basic question. I'm writing a game
where I have keyboard input handling defined in one class, and command
execution defined in another class. The keyboard handler class
contains a dictionary that maps a
Thanks for the suggestions so far. I've taken the advice to keep
things simple so currently I'm just creating one instance of the
commandHandler and assigning it a name with command = commandHandler
(). This makes it easy to call it from any of the other handlers, and
I think this will work for wha
On May 5, 2:17 pm, George Oliver wrote:
> On May 5, 11:59 am, Dave Angel wrote:
>
> > 1) forget about getattr() unless you have hundreds of methods in your
> > map. The real question is why you need two maps. What good is the
> > "command string" doing you? Why not just map the keyvalues direc
On May 5, 11:59 am, Dave Angel wrote:
> 1) forget about getattr() unless you have hundreds of methods in your
> map. The real question is why you need two maps. What good is the
> "command string" doing you? Why not just map the keyvalues directly
> into function objects?
Thanks for the repl
George Oliver wrote:
hi, I'm a Python beginner with a basic question. I'm writing a game
where I have keyboard input handling defined in one class, and command
execution defined in another class. The keyboard handler class
contains a dictionary that maps a key to a command string (like 'h':
'left
On May 5, 9:01 am, Chris Rebert wrote:
> On Tue, May 5, 2009 at 8:52 AM, George Oliver
> wrote:
> > I create instances of these classes in a list attached to a third,
> > 'brain' class.
>
> You could exploit Python's dynamism by using the getattr() function:
Thanks for the responses -- I shou
Chris Rebert writes:
> On Tue, May 5, 2009 at 8:52 AM, George Oliver
> wrote:
>> hi, I'm a Python beginner with a basic question. I'm writing a game
>> where I have keyboard input handling defined in one class, and
>> command execution defined in another class. The keyboard handler
>> class con
On Tue, May 5, 2009 at 8:52 AM, George Oliver wrote:
> hi, I'm a Python beginner with a basic question. I'm writing a game
> where I have keyboard input handling defined in one class, and command
> execution defined in another class. The keyboard handler class
> contains a dictionary that maps a k
hi, I'm a Python beginner with a basic question. I'm writing a game
where I have keyboard input handling defined in one class, and command
execution defined in another class. The keyboard handler class
contains a dictionary that maps a key to a command string (like 'h':
'left') and the command hand
13 matches
Mail list logo