Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. from tkinter import *
  2. import tkinter as tk
  3.  
  4. #panel1
  5. root = tk.Tk()
  6. frame1 = tk.Frame(master=root, width=900, height=800)
  7. canvas = tk.Canvas(frame1, width=900, height= 900)
  8. vsb = tk.Scrollbar(frame1, orient=VERTICAL)
  9. canvas.configure(yscrollcommand=vsb.set,
  10. scrollregion=canvas.bbox("all"))
  11. vsb.configure(command=canvas.yview)
  12. canvas.pack(side=LEFT, fill=BOTH, expand=TRUE)
  13. vsb.pack(fill=Y, side=RIGHT, expand=FALSE)
  14. # notebook.add(frame1, text="1")
  15. frame1.pack(expand=True, fill=BOTH)
  16. root.mainloop()
  17.  
  18. import tkinter as tk
  19.  
  20. #def resize():
  21. # canvas.configure(scrollregion=canvas.bbox("all"))
  22.  
  23. root = tk.Tk()
  24.  
  25. frame1 = tk.Frame(root, width=900, height=800)
  26. frame1.pack(expand=True, fill='both')
  27.  
  28. canvas = tk.Canvas(frame1, width=900, height= 900)
  29. canvas.pack(side='left', fill='both', expand=True)
  30.  
  31. vsb = tk.Scrollbar(frame1, orient='vertical')
  32. vsb.pack(fill='y', side='right', expand=False)
  33. vsb.configure(command=canvas.yview)
  34.  
  35. item_1 = tk.Frame(canvas, bg='red', width=500, height=500)
  36. canvas.create_window(0, 0, window=item_1, anchor='nw')
  37.  
  38. item_2 = tk.Frame(canvas, bg='green', width=500, height=500)
  39. canvas.create_window(500, 500, window=item_2, anchor='nw')
  40.  
  41. canvas.configure(yscrollcommand=vsb.set, scrollregion=canvas.bbox("all"))
  42.  
  43. #root.after(100, resize)
  44.  
  45. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement