-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI.py
62 lines (47 loc) · 1.47 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
import tkinter as tk
root = tk.Tk()
v = tk.IntVar()
v.set(1) # initializing the choice, i.e. Python
languages = [
"English",
"Spanish",
"French",
"Russian",
"Japanese",
]
def ShowChoice():
print(v.get())
tk.Label(root,
text="""Select language:""",
justify = tk.LEFT,
padx = 70).pack()
for val, language in enumerate(languages):
tk.Radiobutton(root,
text=language,
padx = 20,
variable=v,
command=ShowChoice,
value=val).pack(anchor=tk.W)
print("initial key: ", val)
print("initial value: ", language)
root.mainloop()
##############################################################################################
import tkinter
from tkinter import *
root = Tk()
root.title('Random')
Label(text='What would you like translated or defined').pack(side=TOP,padx=10,pady=10)
entry = Entry(root, width=10)
entry.pack(side=TOP,padx=10,pady=10)
def onok():
x, y = entry.get().split('x')
for row in range(int(y)):
for col in range(int(x)):
print((col, row))
Button(root, text='OK', command=onok).pack(side=LEFT)
Button(root, text='CLOSE').pack(side= RIGHT)
confirm = Button(root, text='Confirm',command = lambda:retrieve_input()).pack()
def retrieve_input():
inputValue = textBox.get("1.0","end-1c")
print(inputValue)
root.mainloop()