Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Tkinter import *
- import tkMessageBox
- from PIL import Image, ImageTk
- import sys
- import mysql.connector
- import pickle
- import datetime
- # Global Variable Declarations
- scannerinput = "" # Characters input by the barcode scanner
- keypadValue = "" # Value currently entered into the keypad0
- keypadMode = "Currency" # Currency or Quantity
- menu = "Main" # Currently active menu
- subtotal = 0.00 # Total of items before tax
- taxrate = 1.07 # Tax rate constant
- total = 0.00 # Total including tax
- registerTotal = 0.00 # Current register count
- # Connect to local database
- cnx = mysql.connector.connect(user='root', password='Horsetoaster99', host='localhost', database='schemainventory')
- cursor = cnx.cursor()
- # Handle keyboard/barcode scanner input
- def keyInput(event):
- global scannerinput
- global menu
- if menu == "Sale" or "Ebay Sale":
- print "pressed", repr(event.char)
- if event.char != '\r':
- scannerinput += event.char
- else:
- print "Item scanned."
- itemScanned()
- # An item was scanned
- def itemScanned():
- print "ITEM SCANNED"
- global cursor
- global menu
- global scannerinput
- global items
- query = ("SELECT name, qty, saleprice FROM inventory WHERE id = '" + scannerinput + "'")
- cursor.execute(query)
- for (name, qty, saleprice) in cursor:
- #print name
- #print qty
- #print saleprice
- newItem = item()
- newItem.id = scannerinput
- newItem.name = name
- newItem.qty = 1
- newItem.price = saleprice
- items.insert(0, newItem)
- if menu == "Sale":
- updateItemsList()
- if menu == "Ebay Sale":
- updateEbaySaleList()
- scannerinput = ''
- # Convert keypad string to currency float
- def keypadToCurrency(keypadString):
- if keypadString != "":
- return float(keypadString[0:len(keypadString) - 2]) + (float(keypadString[2:0 - 1]) / 100)
- else: return 0
- # Open Sale Menu
- def saleMenu():
- global menu
- global items
- items = list()
- updateItemsList()
- menu = "Sale"
- menuMain.pack_forget()
- menuSale.pack()
- # Open Sale Menu Quantity Adjustment
- def saleMenuQuantity():
- global menu
- menu = "Sale Quantity"
- global keypadValue
- keypadValue = ""
- global keypadMode
- keypadMode = "Quantity"
- keypad.place(width=436, height=480)
- confirmCancel.place(x=600, y=390)
- keypadDisplay.config(text="1")
- menuSale.pack_forget()
- # Open Sale Menu Pay Cash
- def saleMenuPayCash():
- global menu
- menu = "Sale Pay Cash"
- global keypadValue
- keypadValue = ""
- global keypadMode
- keypadMode = "Currency"
- keypad.place(width=436, height=480)
- confirmCancel.place(x=600, y=390)
- keypadDisplay.config(text="$0.00")
- menuSale.pack_forget()
- # Open card payment confirmation menu
- def saleMenuPayCard():
- global menu
- global total
- menu = "Sale Pay Card"
- menuConfirmSale.pack()
- labelChangeConfirm.config(text="Total Charge: " + '${:,.2f}'.format(total))
- confirmCancel.place(x=600, y=390)
- menuSale.pack_forget()
- # Open Transactions menu
- def transactionsMenu():
- global menu
- menu = "Transactions"
- updateTransactionsListbox()
- menuMain.pack_forget()
- menuTransactions.pack()
- confirmCancel.place(x=600, y=390)
- # Open transaction details menu
- def transactionDetailsMenu():
- global menu
- menu = "Transaction Details"
- menuTransactions.pack_forget()
- menuTransactionDetail.pack()
- confirmCancel.place(x=600, y=390)
- # Exit transaction details menu
- def transactionDetailsMenuBack():
- global menu
- menu = "Transactions"
- menuTransactionDetail.pack_forget()
- menuTransactions.pack()
- # Exit transactions menu
- def transactionsMenuBack():
- global menu
- menu = "Main"
- menuTransactions.pack_forget()
- menuMain.pack()
- # Open Adjustment Menu
- def adjustmentMenu():
- global menu
- global keypadValue
- global keypadMode
- menuMain.pack_forget()
- menuAdjust.pack()
- keypad.place(width=436, height=480)
- keypadMode = "Currency"
- keypadValue = ""
- keypadUpdate()
- menu = "Adjust"
- def adjustmentMenuBack():
- global menu
- menu = "Main"
- menuAdjust.pack_forget()
- keypad.place_forget()
- menuMain.pack()
- def adjustmentMenuAdd():
- global menu
- global keypadValue
- global registerTotal
- global cursor
- global cnx
- if keypadValue == "":
- return
- amount = keypadToCurrency(keypadValue)
- registerTotal += amount
- d = datetime.datetime.now()
- query = ("INSERT INTO transactions "
- "(totalsale, items, transactiontype, paymentmethod, salestax, datetime, itemcount)"
- "VALUES (%s, %s, %s, %s, %s, %s, %s)")
- data = (amount, "", "ADJT", "CASH", "0", d.strftime('%Y-%m-%d %H:%M:%S'), 0)
- cursor.execute(query, data)
- cnx.commit()
- keypadValue = ""
- menu = "Main"
- keypad.place_forget()
- menuAdjust.pack_forget()
- menuMain.pack()
- def adjustmentMenuSub():
- global menu
- global keypadValue
- global registerTotal
- global cursor
- global cnx
- if keypadValue == "":
- return
- amount = keypadToCurrency(keypadValue)
- registerTotal -= amount
- d = datetime.datetime.now()
- query = ("INSERT INTO transactions "
- "(totalsale, items, transactiontype, paymentmethod, salestax, datetime, itemcount)"
- "VALUES (%s, %s, %s, %s, %s, %s, %s)")
- data = (-amount, "", "ADJT", "CASH", "0", d.strftime('%Y-%m-%d %H:%M:%S'), 0)
- cursor.execute(query, data)
- cnx.commit()
- keypadValue = ""
- menu = "Main"
- keypad.place_forget()
- menuAdjust.pack_forget()
- menuMain.pack()
- # Open Generic Item Menu
- def genericItemMenu():
- global menu
- global keypadMode
- global keypadValue
- keypadMode = "Currency"
- keypadValue = ""
- keypadUpdate()
- menuSale.pack_forget()
- menuGenericItem.pack()
- keypad.place(width=436, height=480)
- keypadMode = "Currency"
- menu = "Generic Item"
- def genericItemMenuBack():
- global menu
- keypad.place_forget()
- menuGenericItem.pack_forget()
- menuSale.pack()
- menu = "Sale"
- # Open Ebay sale menu
- def ebaySaleMenu():
- global menu
- global items
- items = list()
- updateEbaySaleList()
- menu = "Ebay Sale"
- menuMain.pack_forget()
- menuEbaySale.pack()
- confirmCancel.place(x=600, y=390)
- # Add generic item to list
- def addGenericItem(name):
- global menu
- if keypadValue == "":
- return
- price = keypadToCurrency(keypadValue)
- newItem = item()
- newItem.name = name
- newItem.price = price
- items.insert(0, newItem)
- updateItemsList()
- menuGenericItem.pack_forget()
- keypad.place_forget()
- menuSale.pack()
- menu = "Sale"
- # Update the database after a transaction is made
- def logTransaction(transactiontype, paymentmethod):
- global cursor
- global cnx
- global items
- global subtotal
- global total
- d = datetime.datetime.now()
- for i in items:
- print i.id
- print str(i.qty)
- query = ("UPDATE inventory SET qty = qty - " + str(i.qty) + " WHERE id='" + i.id + "'")
- cursor.execute(query)
- query = ("UPDATE inventory SET totalsold = totalsold + " + str(i.qty) + " WHERE id='" + i.id + "'")
- cursor.execute(query)
- print d.strftime('%Y-%m-%d %H:%M:%S')
- query = ("UPDATE inventory SET lastsold = '" + d.strftime('%Y-%m-%d %H:%M:%S') + "' WHERE id='" + i.id + "'")
- cursor.execute(query)
- cnx.commit()
- print "Logging transaction"
- totalcount = 0
- for i in items:
- totalcount += i.qty
- query = ("INSERT INTO transactions "
- "(totalsale, items, transactiontype, paymentmethod, salestax, datetime, itemcount)"
- "VALUES (%s, %s, %s, %s, %s, %s, %s)")
- print "TOTAL: " + str(total)
- data = (str(total), pickle.dumps(items), transactiontype, paymentmethod, str(subtotal * 0.07), d.strftime('%Y-%m-%d %H:%M:%S'), totalcount)
- cursor.execute(query, data)
- cnx.commit()
- # Carry out task of confirm button based on the current menu
- def confirm():
- global menu
- global items
- global keypadValue
- global total
- global registerTotal
- global cursor
- global cnx
- if menu == "Sale Quantity":
- items[map(int, itemsListbox.curselection())[0]].qty = int(keypadValue)
- updateItemsList()
- keypad.place_forget()
- confirmCancel.place_forget()
- menu = "Sale"
- menuSale.pack()
- elif menu == "Sale Pay Cash":
- cashreceived = keypadToCurrency(keypadValue)
- tempstring = "Change Due: " + '${:,.2f}'.format(cashreceived - total)
- if cashreceived > total:
- keypad.place_forget()
- confirmCancel.place_forget()
- menuConfirmSale.pack()
- labelChangeConfirm.config(text=tempstring)
- menu = "Change Confirm"
- confirmCancel.place(x=600, y=390)
- elif menu == "Change Confirm":
- registerTotal += total
- logTransaction("SALE", "CASH")
- menuConfirmSale.pack_forget()
- confirmCancel.place_forget()
- menu = "Main"
- menuMain.pack()
- elif menu == "Sale Pay Card":
- logTransaction("SALE", "CARD")
- menuConfirmSale.pack_forget()
- confirmCancel.place_forget()
- menuMain.pack()
- menu = "Main"
- elif menu == "Transactions":
- menuTransactions.pack_forget()
- menuTransactionDetail.pack()
- updateTransactionDetailsList()
- menu = "Transaction Details"
- elif menu == "Ebay Sale":
- for i in items:
- query = ("UPDATE inventory SET qty = qty - " + str(i.qty) + " WHERE id='" + i.id + "'")
- cursor.execute(query)
- query = ("UPDATE inventory SET totalsold = totalsold + " + str(i.qty) + " WHERE id='" + i.id + "'")
- cursor.execute(query)
- cnx.commit()
- confirmCancel.place_forget()
- menuEbaySale.pack_forget()
- menuMain.pack()
- items = list()
- updateEbaySaleList()
- menu = "Main"
- # Carry out cancel button task based on the current menu
- def cancel():
- global menu
- keypad.place_forget()
- confirmCancel.place_forget()
- if menu == "Sale Quantity" or menu == "Sale Pay Cash":
- menu = "Sale"
- menuSale.pack()
- if menu == "Sale Pay Card" or menu == "Change Confirm":
- menu = "Sale"
- menuConfirmSale.pack_forget()
- menuSale.pack()
- if menu == "Transactions":
- menu = "Main"
- menuTransactions.pack_forget()
- menuMain.pack()
- if menu == "Transaction Details":
- menuTransactionDetail.pack_forget()
- menuTransactions.pack()
- confirmCancel.place(x=600, y=390)
- menu = "Transactions"
- if menu == "Ebay Sale":
- confirmCancel.place_forget()
- menuEbaySale.pack_forget()
- menuMain.pack()
- menu = "Main"
- # Void a sale in progress and return to main menu
- def saleMenuVoid():
- global menu
- global items
- items = list()
- menu = "Main"
- menuSale.pack_forget()
- menuMain.pack()
- # Close the POS. WHY ISNT THIS FUCKING WORKING
- def closePOS():
- global root
- root.quit()
- quit()
- # Keypad buttons
- def keypadKey(num):
- global keypadValue
- keypadValue += str(num)
- keypadUpdate()
- # Keypad clear button
- def keypadClear():
- global keypadValue
- if len(keypadValue) > 1:
- keypadValue = keypadValue[:len(keypadValue) - 1]
- else:
- keypadValue = ""
- keypadUpdate()
- # Updates the keypad display
- def keypadUpdate():
- global keypadValue
- global keypadMode
- if keypadMode == "Currency":
- keypadstring = "000"
- if len(keypadValue) < 3:
- keypadstring = "0" * (3 - len(keypadValue)) + keypadValue
- elif keypadValue == "":
- keypadstring = "0"
- else:
- keypadstring = keypadValue
- tempstring = "$" + keypadstring[0:len(keypadstring) - 2] + "." + keypadstring[
- len(keypadstring) - 2:len(keypadstring)]
- elif keypadMode == "Quantity":
- tempstring = keypadValue
- if tempstring == "":
- tempstring = "0"
- keypadDisplay.config(text=tempstring)
- # Updates the items list and (sub)total display
- def updateItemsList():
- print "Updating item list"
- global subtotal
- global total
- global taxrate
- global totals
- global items
- subtotal = 0.0
- total = 0.0
- itemsListbox.delete(0,END)
- for x in range(len(items)):
- print "Adding item"
- length = 18
- itemName = items[x].name[:10]
- itemNameLen = len(itemName)
- itemQtyPrice = " " + str(items[x].qty) + " " + '${:,.2f}'.format(items[x].price)
- for y in range(length - len(itemQtyPrice) - itemNameLen):
- itemName += " "
- itemName += itemQtyPrice
- itemsListbox.insert(END, itemName)
- subtotal += items[x].qty * items[x].price
- subtotal = round(subtotal, 2)
- total = round(subtotal * taxrate, 2)
- tax = round(subtotal * 0.07, 2)
- stringtemp = "Subtotal: " + '${:,.2f}'.format(subtotal) + "\nSales Tax: " + '${:,.2f}'.format(tax) +"\nTotal: " + '${:,.2f}'.format(total) + "\n"
- textTotal.config(text = stringtemp)
- itemsListbox.select_set(0)
- # Updates the items list and (sub)total display
- def updateEbaySaleList():
- global items
- ebaySaleListbox.delete(0,END)
- for x in range(len(items)):
- print "Adding item"
- length = 18
- itemName = items[x].name[:10]
- itemNameLen = len(itemName)
- itemQtyPrice = " " + str(items[x].qty) + " " + '${:,.2f}'.format(items[x].price)
- for y in range(length - len(itemQtyPrice) - itemNameLen):
- itemName += " "
- itemName += itemQtyPrice
- ebaySaleListbox.insert(END, itemName)
- # Updates the transaction details item list
- def updateTransactionDetailsList():
- print "Updating item list"
- global subtotal
- global total
- global taxrate
- global totals
- global items
- global cursor
- global cnx
- global transactions
- subtotal = 0.0
- total = 0.0
- transactionDetailsListbox.delete(0, END)
- items[:] = []
- print "Total number of transactions: " + str(len(transactions))
- i = transactions[map(int, transactionsListbox.curselection())[0]].id
- i = transactions[map(int, transactionsListbox.curselection())[0]].id
- query = ("SELECT totalsale, items, transactiontype, paymentmethod, salestax FROM transactions WHERE id = '" + str(i) + "'")
- cursor.execute(query)
- for (totalsale, items, transactiontype, paymentmethod, salestax) in cursor:
- if transactiontype == "SALE":
- items = pickle.loads(items)
- else:
- items = ""
- print items
- for x in range(len(items)):
- print "Adding item"
- length = 18
- itemName = items[x].name[:10]
- itemNameLen = len(itemName)
- itemQtyPrice = " " + str(items[x].qty) + " " + '${:,.2f}'.format(items[x].price)
- for y in range(length - len(itemQtyPrice) - itemNameLen):
- itemName += " "
- itemName += itemQtyPrice
- transactionDetailsListbox.insert(END, itemName)
- subtotal += items[x].qty * items[x].price
- subtotal = round(subtotal, 2)
- total = round(subtotal * taxrate, 2)
- tax = round(subtotal * 0.07, 2)
- stringtemp = "Subtotal: " + '${:,.2f}'.format(subtotal) + "\nSales Tax: " + '${:,.2f}'.format(
- tax) + "\nTotal: " + '${:,.2f}'.format(total) + "\n"
- textTotal.config(text=stringtemp)
- # Updates the transactions listbox
- def updateTransactionsListbox():
- global cursor
- global cnx
- global transactions
- transactions = list()
- transactionsListbox.delete(0,END)
- d = datetime.date.today()
- query = ("SELECT id, totalsale, items, transactiontype, paymentmethod, salestax, itemcount FROM transactions WHERE date(datetime) >= date '" + d.strftime('%Y-%m-%d') + "' ORDER BY datetime DESC")
- cursor.execute(query)
- for (id, totalsale, items, transactiontype, paymentmethod, salestax, itemcount) in cursor:
- t = transactiontype + " "
- t += paymentmethod + " "
- t += '{:2.0f}'.format(itemcount) + " "
- t += '${:,.2f}'.format(totalsale) + " "
- t += '${:,.2f}'.format(salestax) + " "
- transactionsListbox.insert(END, t)
- newTransaction = transaction()
- newTransaction.id = id
- transactions.append(newTransaction)
- print totalsale
- transactionsListbox.select_set(0)
- # List of today's transactions
- class transaction:
- id = ""
- transactions = list()
- # List of items currenty rung up for sale
- class item:
- id =""
- name = "Item Name"
- qty = 1
- price = 1.00
- items = list()
- # Root tkinter widget
- root = Tk()
- root.geometry("800x480")
- # Load Images
- pngDollar = Image.open("Dollar.png")
- iconDollar = ImageTk.PhotoImage(pngDollar)
- pngAdjustment = Image.open("Adjustment.png")
- iconAdjustment = ImageTk.PhotoImage(pngAdjustment)
- pngPower = Image.open("Power.png")
- iconPower = ImageTk.PhotoImage(pngPower)
- pngHistory = Image.open("History.png")
- iconHistory = ImageTk.PhotoImage(pngHistory)
- pngEbay = Image.open("Ebay.png")
- iconEbay = ImageTk.PhotoImage(pngEbay)
- pngKey = Image.open("Key.png")
- iconKey = ImageTk.PhotoImage(pngKey)
- pngButtonCash = Image.open("ButtonCash.png")
- iconButtonCash = ImageTk.PhotoImage(pngButtonCash)
- pngButtonCard = Image.open("ButtonCard.png")
- iconButtonCard = ImageTk.PhotoImage(pngButtonCard)
- pngButtonVoid = Image.open("ButtonVoid.png")
- iconButtonVoid = ImageTk.PhotoImage(pngButtonVoid)
- pngButtonLookup = Image.open("ButtonLookup.png")
- iconButtonLookup = ImageTk.PhotoImage(pngButtonLookup)
- pngButtonQuantity = Image.open("ButtonQuantity.png")
- iconButtonQuantity = ImageTk.PhotoImage(pngButtonQuantity)
- pngCheck = Image.open("Check.png")
- iconCheck = ImageTk.PhotoImage(pngCheck)
- pngCancel = Image.open("Cancel.png")
- iconCancel = ImageTk.PhotoImage(pngCancel)
- pngButtonBack = Image.open("ButtonBack.png")
- iconButtonBack = ImageTk.PhotoImage(pngButtonBack)
- pngButtonAdjustAdd = Image.open("ButtonAdjustAdd.png")
- iconButtonAdjustAdd = ImageTk.PhotoImage(pngButtonAdjustAdd)
- pngButtonAdjustSub = Image.open("ButtonAdjustSub.png")
- iconButtonAdjustSub = ImageTk.PhotoImage(pngButtonAdjustSub)
- pngButtonTools = Image.open("ButtonTools.png")
- iconButtonTools = ImageTk.PhotoImage(pngButtonTools)
- pngButtonAppliances = Image.open("ButtonAppliances.png")
- iconButtonAppliances = ImageTk.PhotoImage(pngButtonAppliances)
- pngButtonHousewares = Image.open("ButtonHousewares.png")
- iconButtonHousewares = ImageTk.PhotoImage(pngButtonHousewares)
- pngButtonMisc = Image.open("ButtonMisc.png")
- iconButtonMisc = ImageTk.PhotoImage(pngButtonMisc)
- # Main Menu
- menuMain = Frame(root)
- menuMain.pack()
- b1 = Button(menuMain, image=iconHistory, width=260, height=240, command=transactionsMenu).grid(row=1, column=1)
- b2 = Button(menuMain, image=iconEbay, width=260, height=240, command=ebaySaleMenu).grid(row=1, column=2)
- b3 = Button(menuMain, image=iconKey, width=260, height=240).grid(row=1, column=3)
- b4 = Button(menuMain, image=iconDollar, width=260, height=240, command=saleMenu).grid(row=2, column=1)
- b5 = Button(menuMain, image=iconAdjustment, width=260, height=240, command=adjustmentMenu).grid(row=2, column=2)
- b6 = Button(menuMain, image=iconPower, width=260, height=240, command=closePOS).grid(row=2, column=3)
- # Sale Menu
- menuSale = Frame(root)
- root.bind("<Key>", keyInput)
- itemsWidth = 18
- itemsListbox = Listbox(menuSale, selectmode=SINGLE, width=itemsWidth, height=11, font=("Courier", 30))
- itemsListbox.grid(row=1, column=1, rowspan=5)
- textTotal = Label(menuSale, height=4, text="totals", font=("Courier", 16), justify=RIGHT)
- textTotal.grid(row=1, column=2, columnspan=2)
- buttonGeneric = Button(menuSale, image=iconButtonLookup, command=genericItemMenu)
- buttonGeneric.grid(row = 2, column=2)
- buttonQuantity = Button(menuSale, image=iconButtonQuantity, command=saleMenuQuantity)
- buttonQuantity.grid(row=2, column=3)
- buttonCash = Button(menuSale, image=iconButtonCash, command=saleMenuPayCash)
- buttonCash.grid(row=3, column=2, columnspan=2)
- buttonCard = Button(menuSale, image=iconButtonCard, command=saleMenuPayCard)
- buttonCard.grid(row=4, column=2, columnspan=2)
- buttonVoid = Button(menuSale, image=iconButtonVoid, command=saleMenuVoid)
- buttonVoid.grid(row=5, column=2, columnspan=2)
- # Transaction History Menu
- menuTransactions = Frame(root)
- transactionsLegend = Label(menuTransactions, width=30, height=1, font=("Courier", 30))
- transactionsLegend.config(text="TYPE QTY TOTAL TAX ")
- transactionsLegend.pack()
- transactionsListbox = Listbox(menuTransactions, width=30, height=7, font=("Courier", 30))
- transactionsListbox.pack()
- # Transaction Detail Menu
- menuTransactionDetail = Frame(root)
- transactionDetailsListbox = Listbox(menuTransactionDetail, selectmode=SINGLE, width=itemsWidth, height=11, font=("Courier", 30))
- transactionDetailsListbox.grid(row=1, column=1, rowspan=5)
- # Register Adjustment Menu
- menuAdjust = Frame(root)
- itemsWidth = 18
- blankListboxAdjust = Listbox(menuAdjust, selectmode=SINGLE, width=itemsWidth, height=11, font=("Courier", 30))
- blankListboxAdjust.grid(row=1, column=1, rowspan=4)
- blankLabelAdjust = Label(menuAdjust, height=5, font=("Courier", 30))
- blankLabelAdjust.grid(row=1, column=2)
- buttonAdjustAdd = Button(menuAdjust, image=iconButtonAdjustAdd, command=adjustmentMenuAdd)
- buttonAdjustAdd.grid(row=2, column=2)
- buttonAdjustSub = Button(menuAdjust, image=iconButtonAdjustSub, command=adjustmentMenuSub)
- buttonAdjustSub.grid(row=3, column=2)
- buttonAdjustBack = Button(menuAdjust, image=iconButtonBack, command=adjustmentMenuBack)
- buttonAdjustBack.grid(row=4, column=2)
- # Generic Item Menu
- menuGenericItem = Frame(root)
- blankListboxGenericItem = Listbox(menuGenericItem, selectmode=SINGLE, width=itemsWidth, height=11, font=("Courier", 30))
- blankListboxGenericItem.grid(row=1, column=1, rowspan=4)
- blankLabelGenericItem = Label(menuGenericItem, height=5, font=("Courier", 30))
- blankLabelGenericItem.grid(row=1, column=2, columnspan=2)
- buttonGenericTools = Button(menuGenericItem, image=iconButtonTools, command=lambda: addGenericItem("Tools"))
- buttonGenericTools.grid(row=2, column=2)
- buttonGenericAppliances = Button(menuGenericItem, image=iconButtonAppliances, command=lambda: addGenericItem("Appliances"))
- buttonGenericAppliances.grid(row=2, column=3)
- buttonGenericHousewares = Button(menuGenericItem, image=iconButtonHousewares, command=lambda: addGenericItem("Housewares"))
- buttonGenericHousewares.grid(row=3, column=2)
- buttonGenericMisc = Button(menuGenericItem, image=iconButtonMisc, command=lambda: addGenericItem("Misc"))
- buttonGenericMisc.grid(row=3, column=3)
- buttonGenericBack = Button(menuGenericItem, image=iconButtonBack, command=genericItemMenuBack)
- buttonGenericBack.grid(row=4, column=2, columnspan=2)
- # Ebay Sale Menu
- menuEbaySale = Frame(root)
- itemsWidth = 18
- ebaySaleListbox = Listbox(menuEbaySale, selectmode=SINGLE, width=itemsWidth, height=11, font=("Courier", 30))
- ebaySaleListbox.grid(row=1, column=1, rowspan=5)
- # Change Menu
- menuConfirmSale = Frame(root)
- labelChangeConfirm = Label(menuConfirmSale, text="", font=("Courier", 40))
- labelChangeConfirm.grid(row=1, column=1)
- # Keypad
- keypad = Frame(root, borderwidth=2)
- keypadDisplay = Label(keypad, text="$0.00", font=("Courier", 40), background="#ffffff", width=12, anchor=E)
- keypadDisplay.grid(row=1, column=1, columnspan=3, sticky=E)
- keyFontSize = 40;
- keyWidth = 4
- kp7 = Button(keypad, text="7", font=("Courier", keyFontSize), width=keyWidth, command=lambda: keypadKey(7))
- kp7.grid(row=2, column=1)
- kp8 = Button(keypad, text="8", font=("Courier", keyFontSize), width=keyWidth, command=lambda: keypadKey(8))
- kp8.grid(row=2, column=2)
- kp9 = Button(keypad, text="9", font=("Courier", keyFontSize), width=keyWidth, command=lambda: keypadKey(9))
- kp9.grid(row=2, column=3)
- kp4 = Button(keypad, text="4", font=("Courier", keyFontSize), width=keyWidth, command=lambda: keypadKey(4))
- kp4.grid(row=3, column=1)
- kp5 = Button(keypad, text="5", font=("Courier", keyFontSize), width=keyWidth, command=lambda: keypadKey(5))
- kp5.grid(row=3, column=2)
- kp6 = Button(keypad, text="6", font=("Courier", keyFontSize), width=keyWidth, command=lambda: keypadKey(6))
- kp6.grid(row=3, column=3)
- kp1 = Button(keypad, text="1", font=("Courier", keyFontSize), width=keyWidth, command=lambda: keypadKey(1))
- kp1.grid(row=4, column=1)
- kp2 = Button(keypad, text="2", font=("Courier", keyFontSize), width=keyWidth, command=lambda: keypadKey(2))
- kp2.grid(row=4, column=2)
- kp3 = Button(keypad, text="3", font=("Courier", keyFontSize), width=keyWidth, command=lambda: keypadKey(3))
- kp3.grid(row=4, column=3)
- kp0 = Button(keypad, text="0", font=("Courier", keyFontSize), width=(keyWidth * 2), command=lambda: keypadKey(0))
- kp0.grid(row=5, column=1, columnspan=2)
- kpBack = Button(keypad, text="<", font=("Courier", keyFontSize), width=keyWidth, command=keypadClear)
- kpBack.grid(row=5, column=3)
- # Confirm/Cancel
- confirmCancel = Frame(root)
- buttonConfirm = Button(confirmCancel, image=iconCheck, command=confirm)
- buttonConfirm.grid(row=1, column=1)
- buttonCancel = Button(confirmCancel, image=iconCancel, command=cancel)
- buttonCancel.grid(row=1, column=2)
- updateItemsList()
- # Enter tkinter's main loop
- root.mainloop()
Add Comment
Please, Sign In to add comment