Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import string
- class App:
- def change_dropdown(self, *args):
- print(self.Lb1.curselection())
- self.Lb2.insert(self.count, self.choices[self.Lb1.curselection()[0]])
- self.count+=1
- def delete_dropdown_selected(self, *args):
- print(self.Lb2.curselection())
- def __init__(self, master):
- self.count = 0
- self.left = Frame(master)
- self.left.config()
- self.left.pack(side=LEFT)
- self.choices = []
- self.yscroll = Scrollbar(master, orient=VERTICAL)
- self.Lb1 = Listbox(self.left, selectmode=SINGLE, yscrollcommand=self.yscroll.set, font=50, bd=2)
- self.Lb2 = Listbox(self.left, selectmode=SINGLE, bd=2)
- for j in range(2):
- for i in range(26):
- self.Lb1.insert(i,string.ascii_lowercase[i])
- self.choices.append(string.ascii_letters[i])
- self.Lb1.config(width=50, height=30)
- self.Lb1.pack(side=TOP, fill=BOTH, expand=1)
- self.Lb2.config(font=30, width=50, height=10)
- self.Lb2.pack(side=BOTTOM, fill=BOTH, expand=1, pady=10)
- self.Lb2.bind('<<ListboxSelect>>', self.delete_dropdown_selected)
- self.Lb1.bind('<<ListboxSelect>>', self.change_dropdown)
- self.yscroll.pack(side=LEFT, fill=Y)
- self.yscroll.config(command=self.Lb1.yview)
- root = Tk()
- root.resizable(width=False, height=False)
- app = App(root)
- root.mainloop()
- self.Lb2.bind('<<ListboxSelect>>', self.delete_dropdown_selected)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement