-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui.py
More file actions
101 lines (69 loc) · 2.26 KB
/
gui.py
File metadata and controls
101 lines (69 loc) · 2.26 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Project: Simple Python GUI
# Author: Sonny STACKPYTHON
# Date Created: April 2, 2020
from tkinter import *
gui = Tk()
gui.geometry("550x550")
gui.title("STACKPYTHON")
# Define navigation message
name_message = str("Nice to meet you mr.")
age_message = str("Your age is :")
def enter_name():
name_label = Label(gui)
name_label.pack()
output_name_txt = name_message + str(inp_name.get())
name_label.config(text=output_name_txt,
font=("Courier", 12),
bd=10,
width=200)
# Navigation message (name)
name_guide_label = Label(text='Type your name here',
font=("Courier", 12)).pack()
# Form built for retrieving input data (name)
inp_name = StringVar()
name_val = Entry(gui, textvariable=inp_name).pack()
name_btn = Button(text="Enter",
height=4,
width=8,
fg='white',
command=enter_name,
bg='navy',
bd=5,
variable=name_val).pack()
# Navigation message (age)
age_guide_label = Label(text='Type your age here',
font=("Courier", 12)).pack()
# Form built for retrieving input data (age)
inp_age = IntVar()
age_val = Spinbox(gui,
from_=18,
to=30,
textvariable=inp_age)
age_val.pack(side=TOP,)
def enter_age():
age_label = Label(gui)
age_label.pack()
output_age_txt = age_message + str(inp_age.get())
age_label.config(text=output_age_txt,
font=("Courier", 12),
bd=10,
width=200)
age_btn = Button(gui, text="Enter",
height=4,
width=8,
command=enter_age,
bd=5,
bg='navy',
fg='white').pack()
def quite():
quit_btn = Button(text='Quit',
command=gui.quit,
height=4,
width=8,
bg='gold',
bd=5)
quit_btn.pack(side=TOP,
padx=1,
pady=1)
quite()
gui.mainloop()