Advertisement
Guest User

Code 2 - Doesn't work

a guest
Mar 31st, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. import tkinter as tk
  2.  
  3. root=tk.Tk()
  4. root.geometry('100x200')
  5.  
  6. def OnVsb(box,*args):
  7.     box.yview(*args)
  8.  
  9. def make_box_and_scrollbar():
  10.  
  11.     box = tk.Text(root)
  12.     box.pack(side="left",fill="x")
  13.     box.configure(width=10)
  14.  
  15.     vsb = tk.Scrollbar(orient="vertical")
  16.     vsb.pack(side="left",fill="y")
  17.  
  18.     box.configure(yscrollcommand=vsb.set)
  19.  
  20.     vsb.configure(command=OnVsb(box))
  21.  
  22.     box.configure(yscrollcommand=vsb.set)
  23.  
  24.  
  25.     for i in range(15):
  26.         box.insert("end","item %s \n" % i)
  27.  
  28. make_box_and_scrollbar()
  29.  
  30. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement