suhayb 0 Newbie Poster

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)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.