-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pady_in_Pack_creates_margin.py
88 lines (60 loc) · 1.26 KB
/
Pady_in_Pack_creates_margin.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
from tkinter import *
def add():
message = entry.get()
list.insert(len(list.get(0, END)), message)
list.config(height= list.size())
entry.delete(0, END)
def buy():
food = []
for index in list.curselection():
food.append(list.get(index))
print('Your Order:')
for i in food:
print(i)
def delett():
for index in reversed(list.curselection()):
list.delete(index)
list.config(height= list.size())
def bs():
entry.delete(len(entry.get()) -1)
window = Tk()
window.config(padx= 50)
window.config(pady= 50)
list= Listbox(window,
font= ('Arial', 15),
selectmode = MULTIPLE,
)
list.insert(1, 'Apple')
list.insert(2, 'Banana')
list.insert(3, 'Pear')
list.pack(pady=10)
list.config(height= list.size())
button = Button(window,
text= 'Buy',
font= ('Arial', 13),
command = buy,
)
button.pack(pady= 10)
delete= Button(window,
text= 'Delete',
font= ('Arial', 13),
command = delett,
)
delete.pack(pady = 10)
entry = Entry(window,
font= ('Arial', 15),
)
entry.pack(pady= 10)
add = Button(window,
text= 'Add to List',
font= ('Arial', 13),
command = add,
)
add.pack(pady= 10)
bs = delete= Button(window,
text= 'Backspace',
font= ('Arial', 13),
command = bs,
)
bs.pack(pady= 10)
window.mainloop()