I am quite new to Python programming, just started about a week ago, and was just designing a simple menu for a simple guessing game.

I have browsed Google and other websites trying to find snippets of code that may help me but my searches haven't turned up anything.

I've got it displaying the menu correctly;

"(P)lay game

but I am having trouble working out how to get the user input, such as when they push 'i' it displays the instructions for the game and when they push 'p' it starts the game.

If anyone could lead me down the right path it would be greatly appreciated, back to trying to work it out in the mean time.

Do you want to do a graphical application or a console application?


I don't think there is a module or package providing key press event functionality for the console.

If you want user input, you should use the function raw_input in 2.x and input in 3.x.

OP do not necessary need more than input (raw_input in Python 2) Also there should be one Vegaseats snippet how to use Tkinter without window to get key event. You could also adapt the Tkinter menu I have posted before, it is not finally so much more difficult than writing text based app.

if its in console, Then you just get the user input and check the value.
Then instruct your system based on that choice.

Thank you, you were all helpful in different ways.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.