commit bfbfc3dad443776febf928ebff32dd19e7ae2c1c Author: justuswolff Date: Sat Feb 21 03:04:40 2026 +0100 first commit diff --git a/main.py b/main.py new file mode 100644 index 0000000..fe4b9b2 --- /dev/null +++ b/main.py @@ -0,0 +1,80 @@ +import time +import pickle +import tkinter as tk +import easygui + +class dependencyrequirement(): + def __init__(self, name: str,amount: list): + self.name = name + self.amount = amount +class product(): + def __init__(self, name: str,price: float,dependencies: list): + self.name = name + self.price = price + self.dependencies = dependencies +class database(): + def __init__(self): + self.dependencies = [] + self.products = {} + self.stock = {} + pass + def adddep(self, name: str): + self.dependencies.append(name) + self.stock[name] = 0.0 + def addproduct(self, name: str, price: float, dependencies: list): + self.products[name] = product(name,price,dependencies) + def processproduct(self, name: str): + product = self.products[name] + # add changes to stock + for i in product.dependencies: + self.stock[i.name] -= i.amount + +maindata = database() + +def clear(): + for i in range(100): + print() +def products_new(root): + childwin = tk.Toplevel(root) + childwin.title("New product") + + namevar = tk.StringVar(value="Name") + nameinp = tk.Entry(childwin, textvariable=namevar) + nameinp.grid(row=0,column=0) + + pricevar = tk.StringVar(value="Price") + priceinp = tk.Entry(childwin, textvariable=pricevar) + priceinp.grid(row=1,column=0) + + dependencies = tk.Listbox(childwin, selectmode=tk.SINGLE, height=len(maindata.dependencies), width=50) + dependencies.grid(row=2,column=0) + + def close(): + childwin.destroy() # destroy so incase of an fail we still are finished. + maindata.addproduct(namevar.get(), float(pricevar.get()), []) + + addbut = tk.Button(childwin, text="Create", command=close) + addbut.grid(row=10,column=0) + + childwin.mainloop() + +if __name__ == "__main__": + easygui.msgbox("Welcome to CashierSystem PC edition!", "Welcome") + root = tk.Tk() # root + + menubar = tk.Menu(root) # menubar + root.config(menu=menubar) + + promenu = tk.Menu(menubar) # product menu + promenu.add_command( + label='new', + command=lambda: products_new(root), + ) + menubar.add_cascade( + label="Products", + menu=promenu, + underline=0, + ) + + + root.mainloop() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c9ccaf8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +easygui \ No newline at end of file