1

So I have this simple menu in python:

1 - x
2 - y
3 - z
what you gonna do?

I want to ask user to press a number to choose the option but I can't figure it out, instead of making user write the option and pressing enter, I want the user to press number and do the option! How can I achieve this?

  • You should look into one of the graphical libraries: `PyQt` for example, but there are a lot of them. And see if you can follow a tutorial. – Stefan van den Akker Oct 29 '15 at 10:15
  • Possible duplicate of [Python read a single character from the user](http://stackoverflow.com/questions/510357/python-read-a-single-character-from-the-user) – hjpotter92 Oct 29 '15 at 10:17
  • Try Tkinter module it is a built in module so it comes with python. Start Here: https://wiki.python.org/moin/TkInter – J.Clarke Mar 14 '16 at 00:45

2 Answers2

2

You can't really achieve this without using a graphical library. Such as opengl or pygame. This is a great page for python libary's https://wiki.python.org/moin/UsefulModules

J.Clarke
  • 392
  • 2
  • 15
1

A button is a "visual" component, and thus requires a library of some sort to develop with relative ease. As Neftas mentions, there are a number of these libraries out there for free, one being PyQt.

Checkout this thread for more:What Python GUI APIs Are Out There?

Community
  • 1
  • 1
Shane Duffy
  • 1,117
  • 8
  • 18