текст программы…..
[code python]from tkinter import *
root = Tk()
root.title('Покупки')
root.geometry('400x200+500+300')
def toSecond():
selectToSecond = lbox1.curselection()
for i in selectToSecond:
lbox2.insert(END, lbox1.get(i))
for i in reversed(selectToSecond):
lbox1.delete(i)
def toFirst():
selectToFirst = lbox2.curselection()
for i in selectToFirst:
lbox1.insert(END, lbox2.get(i))
for i in reversed(selectToFirst):
lbox2.delete(i)
lbox1 = Listbox(selectmode=EXTENDED)
for i in ["яблоко", "банан", "морковь", "хлеб", "молоко", "кофе", "ЧАЙ", "сахар", "чипсы", "конфеты"]:
lbox1.insert(0,i)
lbox1.pack(side=LEFT,anchor="c", padx=5, pady=5)
lbox2 = Listbox(selectmode=EXTENDED)
lbox2.pack(side=RIGHT,anchor="c", padx=5, pady=5)
f = Frame()
f.pack(side=LEFT, padx=10)
Button(f, text=">>>", command=toSecond, width=40).pack(fill=X)
Button(f, text="<<<", command=toFirst, width=40).pack(fill=X)
lab1 = Label(root, text = 'количество покупок:')
lab1.place(x = 150, y = 130)
lab2 = Label(root, text = lbox2.size())
lab2.place(x = 190, y = 150)
k = lbox2.size()
lab2.config(text = str(k))
root.mainloop()[/code]