def addCustomer(): customerID = customerIDTab2.get() name = customerNameTab2.get() result = pos.addCustomer(customerID,name) if(result['error']==True): customerResultLabel.configure(fg="red" , text=result['message']) else: customerResultLabel.configure(fg="green" , text=result['message']) quote = pos.getAllCustomersNames() T.delete('1.0', END) T.insert(END,quote)
RegistSale.grid(row=5, column=2, sticky=N+S+E+W) chButton.grid(row=5, column=1, sticky=N+S+E+W) #SECOND TAB tab2 = Tab(root, "Customers") frame1t2=Frame(tab2, bd=3, relief="groove") label0tab2 = Label(frame1t2, text="List of customers:", font=("Helvetica", 20), fg="black").pack(side=TOP, expand=YES, fill=BOTH) S = Scrollbar(frame1t2) T = Text(frame1t2, height=4, width=50) S.pack(side=RIGHT, fill=Y) T.pack(side=LEFT, fill=Y) S.config(command=T.yview) T.config(yscrollcommand=S.set) quote = pos.getAllCustomersNames() T.insert(END, quote) sep1t2=ttk.Separator(tab2,orient=VERTICAL) frame2t2=Frame(tab2, bd=3, relief="groove") label1tab2 = Label(frame2t2, text="Register a Customer:", font=("Helvetica", 20), fg="black").pack(side=TOP, expand=YES, fill=BOTH) label2tab2 = Label(frame2t2, text="Customer ID: ", font=("Helvetica", 10), fg="black").pack() customerIDTab2 = Entry(frame2t2 , text="") customerIDTab2.pack() label3tab2 = Label(frame2t2, text="Customer Name: ", font=("Helvetica", 10), fg="black") customerNameTab2 = Entry(frame2t2) label3tab2.pack() customerNameTab2.pack() customerResultLabel = Label(frame2t2, text="") customerResultLabel.pack() Button(frame2t2, text="Register new customer", command=addCustomer).pack()