Advertisement
here2share

# tk_basic_scrollbar.py

Jun 14th, 2024
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. # tk_basic_scrollbar.py
  2.  
  3. from tkinter import *
  4.  
  5. ww = 600
  6. hh = 600
  7.  
  8. root = Tk()
  9. root.geometry(f"{ww}x{hh}")
  10.  
  11. scrollbar = Scrollbar(root)
  12. scrollbar.pack(side=RIGHT, fill=Y)
  13.  
  14. canvas1=Canvas(root, yscrollcommand=scrollbar.set, width=ww, height=hh)
  15. canvas1.pack()
  16. coord = [40, 100, 400, 600]
  17. arc = canvas1.create_rectangle(*coord, outline="#fb0", fill="#fb0")
  18.  
  19. scrollbar.config(command=canvas1.yview)
  20. canvas1.config(scrollregion=(0, 0, 1000, 1000))
  21.  
  22. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement