0

i want to make simple cafe management system in Tkinter the buttons are automatically generating from a database so how i can get the names of the buttons and their price from a database and also want so insert this into a receipt(textbox) thanks

def showbreakfast():
    data1 = readbreakfast()
    for index, dat in enumerate(data1):
        ttk.Button(master, text=dat[0],command=lambda :update_count(3)).grid(row=index+1, column=0,padx=0, pady=0)

def update_count(value):
    global bttn,bttn_clicks,my_text,my_text1,my_text2
    my_text=StringVar()
    my_text1=StringVar()
    my_text = my_button.cget('text')
    my_text1 = my_butto.cget('text')
    #my_text2 = namee.cget('text')

    bttn_clicks += 1
    bttn = IntVar()
    global variable
    variable = value
    #var=variable

    print(update_count)

def Receipt():

txtReceipt.delete("1.0", END)
x = random.randint(10908, 500876)
randomRef = str(x)
Receipt_Ref.set("BILL" + randomRef)

txtReceipt.insert(END, 'Receipt Ref: \t\t\t'+Receipt_Ref.get()+"\t\t"+DateofOrder.get()+"\n")
txtReceipt.insert(END, 'Items\t\t'+'Quantity\t\t\t'+"Price \n\n")
#txtReceipt.insert(END, str(my_text)+'\t\t'+str(bttn_clicks)+'\t\t\t'+""+str(bttn_clicks*3)+"\n\n")
#txtReceipt.insert(END, str(my_text1)+'\t\t'+str(bttn_clicks)+'\t\t\t'+""+str(bttn_clicks*3)

Edited by happygeek: moved to programming section

1
Contributor
0
Replies
15
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.