forked from autorouting/main
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.py
50 lines (37 loc) · 1.56 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
from tkinter import *
from tkinter.scrolledtext import ScrolledText
import random
root = Tk()
root.title("Autorouting app (one-vehicle)")
label1 = Label(root, text="City:")
label1.pack()
citybox = Entry(root, width=50)
citybox.pack()
label2 = Label(root, text="Driver address:")
label2.pack()
driveraddressbox = Entry(root, width=50)
driveraddressbox.pack()
label3 = Label(root, text="Restraunt address:")
label3.pack()
restrauntaddressbox = Entry(root, width=50)
restrauntaddressbox.pack()
label4 = Label(root, text="Paste consumer addresses below:")
label4.pack()
consumeraddressbox = ScrolledText(root, width=50, height=30)
consumeraddressbox.pack()
def onclick():
locationstextfile = open("locations.txt", "w")
locationstextfile.write(driveraddressbox.get().replace("\n", "") + "\n" + restrauntaddressbox.get().replace("\n", "") + "\n" + consumeraddressbox.get('1.0', END))
locationstextfile.close()
city = citybox.get()
for widget in root.winfo_children():
widget.destroy()
loading = Label(root, text="Loading...")
loading.pack()
code_to_exec = open("onevehicleroutegen.py").read().replace('input("city (ex.: Piedmont, California, USA):\\n ")', "'" + city + "'").replace('input("Your app name:\\n ")', "'" + str(random.randint(0, 999)) + str(random.randint(0, 999)) + "'") + "\n exec(open('genmapslink.py').read())"
exec(code_to_exec)
myButton = Button(root, text="Launch program", command=onclick)
myButton.pack()
bottomtext = Label(root, text="Find us on GitHub: https://github.com/autorouting/main")
bottomtext.pack()
root.mainloop()