Skip to content Skip to sidebar Skip to footer

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

  1. In your function show_menu(): you never asked for any input from the user. You are always returning 0.
  2. In your function move(): x and y are not updated. You're passing the updated x and y to show_grid(), but after that they are not used.
  3. You currently break out of your #main program if choice == 0.

Here's what you'll have to do to fix each of the problems I mentioned above:

  1. In your function show_menu(): ask for the user's input and return it instead of 0.
  2. Return the new values of x and y that you are currently passing to show_grid().
  3. 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"