-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.py
93 lines (66 loc) · 2.17 KB
/
gui.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import time
import threading
import sys
from tkinter import *
from tkinter import messagebox
# from tkinter import ttk
from tkinter.ttk import *
"""
This is the setup GUI
"""
class Gui:
startTime = None
elapsedTime = None
labelTime = None
labelStatus = None
botName = None
root = None
isRunning = False
scriptStatus = "Testing"
def __init__(self):
self.scriptSelected = None
self.startTime = time.time()
self.isRunning = True
self.breaks = False
def getDesiredScript(self, scripts:list = [None,"Fisher", "WoodCutter", "Miner"]):
def onSubmitClick():
if v.get() == "1":
self.breaks = True
self.scriptSelected = selected_option.get()
# print(self.scriptSelected)
root.quit()
root.destroy()
return self.scriptSelected
root = Tk()
root.title("Script Selector")
root.lift()
root.attributes("-topmost", True)
selected_option = StringVar(root)
selected_option.set(scripts[0])
frm = Frame(root,padding=10)
frm.grid()
scriptLabel = Label(frm, text="Choose a Script").grid(column=0,row=0)
option_menu = OptionMenu(frm, selected_option, *scripts)
option_menu.grid(column=0, row=2, pady=(10,0))
option_menu.config(width=15)
v = StringVar(root, "1")
values = {
"Breaks":"1",
"No Breaks": "2",
}
for (text,value) in values.items():
Radiobutton(root, text=text, variable=v,
value=value).grid(column=0,row=int(value)+2)
submitButton = Button(root,text="Submit",command=onSubmitClick)
submitButton.grid(column=0, row=5)
# v.trace_add("write",onButtonChange)
# selected_option.trace_add("write", on_option_changed)
root.mainloop()
def fatalErrorPopUp(self, message="Fatal Error please report bug!"):
root = Tk()
root.withdraw()
messagebox.showerror("Fatal Error", message)
sys.exit(1)
if __name__ == "__main__":
g = Gui()
g.fatalErrorPopUp()