daily pastebin goal
11%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from tkinter import *
  2. import string
  3.  
  4. class App:
  5.  
  6.     def change_dropdown(self, *args):
  7.         print(self.Lb1.curselection())
  8.         self.Lb2.insert(self.count, self.choices[self.Lb1.curselection()[0]])
  9.         self.count+=1
  10.  
  11.     def delete_dropdown_selected(self, *args):
  12.         print(self.Lb2.curselection())
  13.  
  14.  
  15.     def __init__(self, master):
  16.  
  17.         self.count = 0
  18.  
  19.         self.left = Frame(master)
  20.         self.left.config()
  21.         self.left.pack(side=LEFT)
  22.  
  23.         self.choices = []
  24.  
  25.         self.yscroll = Scrollbar(master, orient=VERTICAL)
  26.  
  27.         self.Lb1 = Listbox(self.left, selectmode=SINGLE, yscrollcommand=self.yscroll.set, font=50, bd=2)
  28.         self.Lb2 = Listbox(self.left, selectmode=SINGLE, bd=2)
  29.  
  30.         for j in range(2):
  31.             for i in range(26):
  32.                self.Lb1.insert(i,string.ascii_lowercase[i])
  33.                self.choices.append(string.ascii_letters[i])
  34.  
  35.         self.Lb1.config(width=50, height=30)
  36.         self.Lb1.pack(side=TOP, fill=BOTH, expand=1)
  37.         self.Lb2.config(font=30, width=50, height=10)
  38.         self.Lb2.pack(side=BOTTOM, fill=BOTH, expand=1, pady=10)
  39.         self.Lb2.bind('<<ListboxSelect>>', self.delete_dropdown_selected)
  40.         self.Lb1.bind('<<ListboxSelect>>', self.change_dropdown)
  41.         self.yscroll.pack(side=LEFT, fill=Y)
  42.         self.yscroll.config(command=self.Lb1.yview)
  43.  
  44.  
  45. root = Tk()
  46. root.resizable(width=False, height=False)
  47. app = App(root)
  48. root.mainloop()
  49.      
  50. self.Lb2.bind('<<ListboxSelect>>', self.delete_dropdown_selected)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top