-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInventory.py
70 lines (60 loc) · 1.63 KB
/
Inventory.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
# Import Statements
import tkinter.messagebox
from ttkbootstrap import *
import openpyxl as opx
import sqlite3
# Window
root = Window(themename = "vapor")
root.geometry("800x500")
root.title("IM Inventory")
# Open inventory sheet
Custum = opx.load_workbook("Inventory.xlsx")
Sheeter = Custum.active
# Stringvar
Bile = StringVar()
# Style
my = Style()
my.configure("default.TButton",
font=("Trebuchet MS",
18))
# Entry
E1 = Entry(root,
font=("Trebuchet MS",
10),
width = 30)
E1.place(relx = 0.5,
rely = 0.3,
anchor = "center")
# Label
L1 = Label(root,
textvariable=Bile,
font=("Comic Sans MS",
18),
bootstyle="light")
L1.place(relx = 0.5,
rely = 0.7,
anchor = "center")
def getteg():
global E1,\
L1
Eget = E1.get()
for i in range(2, 10):
Cell = Sheeter.cell(row=i,
column=1)
if Eget.lower() == Cell.value.lower():
Bile.set(f"Stock: {Sheeter.cell(row=i,
column=2).value}")
break
else:
tkinter.messagebox.showinfo("openpyxl.Error",
"Sorry, this sweet doesn't exist.")
# Button
B1 = Button(root,
text="Submit", width = 10,
style="default.TButton",
command=lambda: getteg())
B1.place(relx = 0.5,
rely = 0.5,
anchor = "center")
# Mainloop
root.mainloop()