Update: Mesh Grid Python
I'm working on a mesh grid that has a cursor that moves when you enter the assigned number. I was able to get the cursor to move, the only problem I'm having is that I want it to p
Solution 1:
Inside your definition of move()
, you are using return
(ie, exiting the function) before you get to the part that calls show_grid()
EDIT: instead of returning, just set x, y to whatever they need to be. Also, I noticed one other thing that may be causing you problems. You use option
to decide what to do next, and option = show_menu()
. But the way you've defined show_menu()
, it always returns 0. In order for options
to contain the user's input, you should either change the way show_menu()
is defined, or change the way option
is assigned.
Edit after OP's update: Here are the problems that I see
- In your function
show_menu()
: you never asked for any input from the user. You are always returning0
. - In your function
move()
:x
andy
are not updated. You're passing the updatedx
andy
toshow_grid()
, but after that they are not used. - You currently
break
out of your#main program
ifchoice == 0
.
Here's what you'll have to do to fix each of the problems I mentioned above:
- In your function
show_menu()
: ask for the user's input and return it instead of 0. - Return the new values of
x
andy
that you are currently passing toshow_grid()
. - Remove
break
. If you do this without fixing #1 first you'll end up in an infinite loop - but if you fix #1 first it will wait for user input.
Post a Comment for "Update: Mesh Grid Python"