-
Notifications
You must be signed in to change notification settings - Fork 1
/
fieldGUI.py
45 lines (34 loc) · 1.32 KB
/
fieldGUI.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
from tkinter import *
class Window(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.master = master
self.init_window()
def Field1():
top.title("Field 1")
top.geometry("500x500")
button1 = Button(top, text = 'close')
button1.pack()
#Creation of init_window
def init_window(self):
# changing the title of our master widget
self.master.title("GUI")
# allowing the widget to take the full space of the root window
self.pack(fill=BOTH, expand=1)
top = Toplevel()
# creating a button instance
Field_1 = Button(self, text="FIELD 1",fg = 'red', command = top.Field1 )
Field_2 = Button(self, text="FIELD 2", fg = 'green')
Field_3 = Button(self, text="FIELD 3")
Field_4 = Button(self, text="FIELD 4", fg ='brown')
# placing the button on my window
Field_1.place(x=123, y=10)
Field_2.place(x=180, y=10)
Field_3.place(x =123, y = 40)
Field_4.place(x =180, y = 40)
root = Tk()
label = Label (text='Which field information do you want to see',font = 30).pack()
#size of the window
root.geometry("400x300")
app = Window(root)
root.mainloop()