from tkinter import *
These are two lists which has prices and product details.
price_audible = ['$1.99', '$1.50', '$1.00', '$1.99', '$1.50', '$1.00', '$1.99', '$1.50', '$1.00', '$1.99']
description_audible = ['1: Aaaaaa', '2: bbbbbb', '3: ccccccccc', '4: dddddddddd', '5:eeeeeeee',
'6: fffffff', '7: gggggggg', '8: hhhh', '9: ii', '10: jjjjjjjjjjjjjjjjj']
audible_newlist = ''
for m in range(0, 10):
'
'
var_1=('#'+description_audible[m])+ '
' +('('+price_audible[m]+')')+'
'
audible_newlist = audible_newlist + var_1
show_window = audible_newlist
dash_1 = Tk()
dash_1.configure(bg = 'red')
dash_1.title("Amazon Bestsellers Audible")
show_window = StringVar()
show_window.set(audible_newlist)
conction = IntVar()
def audible_catagory():
new_pc = Toplevel(dash_1)
new_pc.title('Amazon Bestsellers PC')
Label(new_pc, text = "Amazon Bestsellers PC", font = ('Arial', 14),
bg='red', fg='floralwhite').pack()
Label(new_pc, textvariable = show_window, justify = LEFT, bg= 'light yellow',takefocus = True).pack()
Label(dash_1, text = "Amazon Bestsellers Audible", font = ('Arial', 14), bg='red', fg='floralwhite').pack()
Label(dash_1, text = show_window).pack()
Button(dash_1, text = 'Add to cart').pack()
Radiobutton(dash_1, text = 'Amazon Audible', value = True, variable = conction, command =audible_catagory).place(x=0, y=0)
spin_box = Spinbox(dash_1, from_=0, to=10, fg = 'black',
width = 2, justify = RIGHT, relief = 'flat', bg = 'red').pack()
dash_1.mainloop()
When you run this python code it creates a window, which has a radiobutton, and when that radiobutton clicked it pops up another window which displaying the items price and its name from 1 to 10 items. There is a spinbox when which has values from 1 to 10. There is also a button called add to cart.
How do I connect this spinbox to the rest of the code and the add to cart button. So when someone want to buy item number nine they will use the spinbox to select item nine and then when they press add to cart button the item will be added to a list. which will display the total cost of the items.
If anyone can help will be much appreciated.
See Question&Answers more detail:
os