-
Notifications
You must be signed in to change notification settings - Fork 0
/
gui_buttons.py
192 lines (139 loc) · 2.53 KB
/
gui_buttons.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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
from tkinter import *
#Functions
def submit():
email = entry1.get()
password = entry2.get()
print('Logged in as', email, 'your password is', password)
def backspace():
if entry1.get():
entry1.delete(len(entry1.get()) -1, END)
elif entry2.get():
entry2.delete(len(entry2.get()) -1, END)
def delete():
entry1.delete(0, END)
entry2.delete(0, END)
def showp():
entry2.config(show = '')
def hide():
entry2.config(show='*')
def checkit():
if (x.get() == 1):
entry2.config(show='')
else:
entry2.config(show='*')
#Window
window = Tk()
window.config(background='lightblue')
#variable
x = IntVar()
#Label
label = Label(window,
text = 'Login',
font = ('Arial', 15, 'bold'),
bg = 'lightblue'
)
label.pack()
#entry
entry1 = Entry(window,
placeholder = 'Email',
font = ('Times New Roman', 15)
)
entry1.pack()
entry2 = Entry(window,
placeholder = 'Password',
font = ('Times New Roman', 15),
show = "*"
)
#entry2.insert(0, 'Pass')
entry2.pack()
#buttons
submit = Button(window,
text= 'Sign in',
command=submit,
bg= 'green',
fg= 'white'
)
submit.pack()
#backspace button
backspace_b = Button(window,
text= 'Backspace',
command=backspace,
bg= 'orange',
fg= 'white'
)
backspace_b.pack()
#delete button
delete_b = Button(window,
text= 'Delete',
command=delete,
bg= 'red',
fg= 'white'
)
delete_b.pack()
#show button
show = Button(window,
text='Show Password',
bg = 'white',
fg = 'blue',
command = showp
)
show.pack()
#hide button
hiden = Button(window,
text = 'Hide Password',
bg= 'white',
fg= 'red',
command= hide,
)
hiden.pack()
#checkbutton
checker = Checkbutton(window,
text= 'Show Password',
variable= x,
onvalue=1,
offvalue=0,
command= checkit
)
checker.pack()
#Radio button
food = ["Pizza", "Meat Pie", "Egg Roll"]
y = IntVar()
for index in range(len(food)):
radio = Radiobutton(window,
text = food[index],
variable = y,
value = index,
padx = 5,
pady = 5,
bg= "lightblue",
indicator = 0,
width = 100
)
radio.pack(anchor = W)
#Scale
scale = Scale(window,
from_ = 100,
to = 0,
width= 30,
length = 300,
tickinterval = 10,
resolution = 5,
troughcolor = 'blue',
bg = 'black',
fg = 'white',
showvalue = 0,
orient= HORIZONTAL,
)
scale.pack()
#List Box
list_box = Listbox(window,
width = 30,
)
list_box.pack()
list_box.insert(1, 'Pizza')
list_box.insert(2, 'Salad')
list_box.insert(3, 'Burger')
list_box.insert(4, 'Shrimps')
list_box.insert(5, 'Sandwich')
list_box.config(height = list_box.size())
window.mainloop()