Hi again all,
I probably already know you will say 'no', but I will ask on the off
chance that there is a way. I am about to implement an accelerator
table for my Battleship game. I have at least eight different movement
keystrokes, and there will likely be more once I get the table working
(which will give me an easy way to define hotkeys). I would much
rather have a single move function which takes two args, how many
squares to move and in which direction to move. Is there any way at
all of passing this single move function different args depending on
the hotkey pressed? The docs say that the third arg to the table item
is a function's id, as an int, so I very much doubt that what I want
to do is possible. However, I wonder if there is a workaround that
someone has come up with to get around this?
···
--
Have a great day,
Alex (msg sent from GMail website)
mehgcap@gmail.com; http://www.facebook.com/mehgcap
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
I think you can do it using lamba. See the following wiki page for ideas:
http://wiki.wxpython.org/Passing%20Arguments%20to%20Callbacks
···
On Sun, May 23, 2010 at 2:27 PM, Alex Hall mehgcap@gmail.com wrote:
Hi again all,
I probably already know you will say ‘no’, but I will ask on the off
chance that there is a way. I am about to implement an accelerator
table for my Battleship game. I have at least eight different movement
keystrokes, and there will likely be more once I get the table working
(which will give me an easy way to define hotkeys). I would much
rather have a single move function which takes two args, how many
squares to move and in which direction to move. Is there any way at
all of passing this single move function different args depending on
the hotkey pressed? The docs say that the third arg to the table item
is a function’s id, as an int, so I very much doubt that what I want
to do is possible. However, I wonder if there is a workaround that
someone has come up with to get around this?
–
Have a great day,
Alex (msg sent from GMail website)
mehgcap@gmail.com; http://www.facebook.com/mehgcap
–
Mike Driscoll
Blog: http://blog.pythonlibrary.org
–
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
Hi again all,
I probably already know you will say 'no', but I will ask on the off
chance that there is a way. I am about to implement an accelerator
table for my Battleship game. I have at least eight different movement
keystrokes, and there will likely be more once I get the table working
(which will give me an easy way to define hotkeys). I would much
rather have a single move function which takes two args, how many
squares to move and in which direction to move. Is there any way at
all of passing this single move function different args depending on
the hotkey pressed? The docs say that the third arg to the table item
is a function's id, as an int, so I very much doubt that what I want
to do is possible. However, I wonder if there is a workaround that
someone has come up with to get around this?
--
Have a great day,
Alex (msg sent from GMail website)
mehgcap@gmail.com; Redirecting...
I think you can do it using lamba. See the following wiki page for ideas:
Passing Arguments to Callbacks - wxPyWiki
Thanks, this looks like it will work. As soon as my table starts
working properly I can implement this and get rid of ten redundant
functions!
···
On 5/23/10, Mike Driscoll <mike@pythonlibrary.org> wrote:
On Sun, May 23, 2010 at 2:27 PM, Alex Hall <mehgcap@gmail.com> wrote:
--
-----------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
--
Have a great day,
Alex (msg sent from GMail website)
mehgcap@gmail.com; Redirecting...
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en