-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuimGUI.py
More file actions
69 lines (51 loc) · 1.85 KB
/
uimGUI.py
File metadata and controls
69 lines (51 loc) · 1.85 KB
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
# set_window_geometry.py
import uimFuncs, os
from tkinter import *
root = Tk()
# Make window 300x150 and place at position (50,50)
root.geometry("300x400+50+50")
root.title("UI Migrate")
status = StringVar()
status.set("Status")
# Create a label as a child of root window
entries = [Label(root, text='Current Account'), Entry(root),
Label(root, text='Target Account'), Entry(root),
Label(root, text='Current Realm'), Entry(root),
Label(root, text='Target Realm'), Entry(root),
Label(root, text='Current Character'), Entry(root),
Label(root, text='Target Character'), Entry(root),
Label(root, textvariable=status)]
entries[1].insert(INSERT, 'acc')
entries[3].insert(INSERT, 'newacc')
entries[5].insert(INSERT, 'realm')
entries[7].insert(INSERT, 'newrealm')
entries[9].insert(INSERT, 'char')
entries[11].insert(INSERT, 'newchar')
for ent in entries:
ent.pack()
def migrate():
"""Where the magic happens"""
indata = []
for ent in entries:
if type(ent) == Entry and ent.get().strip() != '':
indata.append(ent.get().strip())
#print(indata)
if len(indata) != 6:
print("Error: Empty field(s)")
status.set("Error: Empty field(s)")
return
oldPath = uimFuncs.getPaths(indata[0],indata[2], indata[4])
newPath = uimFuncs.getPaths(indata[1],indata[3], indata[5])
#print("oldPath: ", oldPath)
#print("newPath: ", newPath)
status.set("Migrating account...")
uimFuncs.migrateAccount(oldPath, newPath)
status.set("Done!")
return
# Create a button that will print the contents of the entry
run_button = Button(root, text='Migrate', command=migrate)
run_button.pack()
# Create a button that will destroy the main window when clicked
exit_button = Button(root, text='Exit Program', command=root.destroy)
exit_button.pack()
root.mainloop()