-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.py
59 lines (50 loc) · 1.75 KB
/
template.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Choose.py
# by [YourNameHere]
# Description: starter code for the Choose Your
# Own Adventure Project
# Import Statements
from tkinter import *
import tkinter.simpledialog
import tkinter.messagebox
root = Tk()
w = Label(root, text="Choose Your Own Adventure")
w.pack()
def intro():
""" Introductory Function -> starts the story going """
messagebox.showinfo("Title", "\nHello, you are a _____ from ____. " + \
"You stumble across such and such.")
choice = simpledialog.askinteger("Choose wisely",
"You have a choice to pick: 1 or 2.")
if choice == 1:
choice1()
elif choice == 2:
choice2()
else:
intro()
################ Student A Functions #####################
def choice1():
choice = simpledialog.askinteger("Choose wisely",
"This is the next part of the story. Now you must choose 1 or 2 again.")
if (choice == 1):
messagebox.showinfo("The End",
"You chose right. THE END")
elif (choice == 2):
messagebox.showinfo("The End",
"You chose ok. THE END")
else:
choice1()
################ Student B Functions #####################
def choice2():
choice = simpledialog.askinteger("Choose wisely",
"This is the next part of the story. Now you must choose 1 or 2 again.")
if (choice == 1):
messagebox.showinfo("The End",
"You chose right. THE END")
elif (choice == 2):
messagebox.showinfo("The End",
"You chose ok. THE END")
else:
choice2()
################ Main #####################
intro()
root.destroy()