Ask coding questions

← Back to all posts
How do I make a menu in python?
jimeastman (18)

How do I make a menu in python without tkinter? I try combining html and python to no avail.

Answered by amaddentcsec (239) [earned 5 cycles]
View Answer
Comments
hotnewtop
amaddentcsec (239)

@jimeastman
Tkinter is NOT the only way to make a menu. You can also make a FLASK python repl (which can connect to html), a TURTLE python repl, or a PYGAME python repl. If you do not know how to code in these, simply watch some tutorials!

jimeastman (18)

What the heck is a cycle? I clicked on an answer and @amaddentcsec got 5 cycles.

Codejira (173)

I made a menu the other day. Console only.
See https://repl.it/@Codejira/Text-Menu for inspiration.

PattanAhmed (1404)

@jimeastman Hi,
Here is just an example and it is just incomplete :):-
You can try to edit the code on how much flexibility you want.

students = []
ans = True
while ans:
    print ("""
    1.Add a Student
    2.Delete a Student
    3.Look Up Student Record
    4.Exit/Quit
    """)
    ans=input("What would you like to do? ") 
    if ans=="1": 
      student_name = input('Please input a student\'s name: ')
      students.append(student_name)
      print("\n Student Added")
    elif ans=="2":
      print("\n Student Deleted") 
    elif ans=="3":
      print("\n Student Record Found") 
    elif ans=="4":
      print("\n Goodbye") 
      break
    elif ans !="":
      print("\n Not Valid Choice Try again") 

Some help was taken from this website

Try and tell me the results.

That's it
Thanks!

Hope this helps

PattanAhmed (1404)

@jimeastman Welcome!
Happy to help you!

Please mark my answer if that helps
Thanks!

Coder100 (18125)

well HTML isn't going to work well with python...

Anyways, what are you trying to do?

jimeastman (18)

@Coder100 For an assignment for a class I am taking, I have to create a menu of options and based on what menu item a user clicks, it asks them certain questions that they must answer and then gives data based on their answers. I am trying to make a button menu but the Python IDLE that I am required to use does not support tkinter.