Advertisement
MrsMcLead

ECS menu

Nov 21st, 2013
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.40 KB | None | 0 0
  1. from tkinter import *
  2. import tkinter.simpledialog
  3. import tkinter.messagebox
  4.  
  5. root = Tk()
  6. w = Label(root, text="Menu")
  7. w.pack()
  8.  
  9. choice = 0
  10. while choice != 5:
  11.     choice = tkinter.simpledialog.askinteger("Order", "Enter the number of what you want to order:\n" +
  12.                         "1: pizza\n"+
  13.                         "2: hamburger\n"+
  14.                         "3: taco\n"+
  15.                         "4: donut\n"+
  16.                         "5: quit")
  17.     if choice == 1:
  18.         tkinter.messagebox.showinfo("Pizza", "One slice of pizza with extra ANCHOVIES")
  19.     elif choice == 2:
  20.         tkinter.messagebox.showinfo("Hamburger", "Sorry, I ran out of beef.  This hamburger is made from donkey meat.")
  21.     elif choice == 3:
  22.         tkinter.messagebox.showinfo("Taco", "One taco de lengua (tongue) coming up.")
  23.     elif choice == 4:
  24.         tkinter.messagebox.showinfo("Donut", "mmm... donuts")
  25.  
  26. tkinter.messagebox.showinfo("Thanks", "Thank you, come again!")
  27.  
  28.  
  29. #   One good use of a while loop is a menu.  Try out the following menu and complete the following:
  30. #  
  31. #   1. Add your own three creative choices (make them 5, 6, and 7).
  32. #   2. Move quit to be choice number 8.
  33. #   3. Adjust the loop so that it will quit when 8 is chosen instead of 5.
  34. #  
  35. #   Extra Credit:
  36. #   Sum up peoples choices and give a summary when they quit.
  37. #   For instance, if 5 people choose pizza, and 1 chooses donut, then they quit,
  38. #   you should output:
  39. #   5 pizzas, 0 hamburgers, 0 tacos, 1 donuts.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement