Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import tkinter as tk
- #panel1
- root = tk.Tk()
- frame1 = tk.Frame(master=root, width=900, height=800)
- canvas = tk.Canvas(frame1, width=900, height= 900)
- vsb = tk.Scrollbar(frame1, orient=VERTICAL)
- canvas.configure(yscrollcommand=vsb.set,
- scrollregion=canvas.bbox("all"))
- vsb.configure(command=canvas.yview)
- canvas.pack(side=LEFT, fill=BOTH, expand=TRUE)
- vsb.pack(fill=Y, side=RIGHT, expand=FALSE)
- # notebook.add(frame1, text="1")
- frame1.pack(expand=True, fill=BOTH)
- root.mainloop()
- import tkinter as tk
- #def resize():
- # canvas.configure(scrollregion=canvas.bbox("all"))
- root = tk.Tk()
- frame1 = tk.Frame(root, width=900, height=800)
- frame1.pack(expand=True, fill='both')
- canvas = tk.Canvas(frame1, width=900, height= 900)
- canvas.pack(side='left', fill='both', expand=True)
- vsb = tk.Scrollbar(frame1, orient='vertical')
- vsb.pack(fill='y', side='right', expand=False)
- vsb.configure(command=canvas.yview)
- item_1 = tk.Frame(canvas, bg='red', width=500, height=500)
- canvas.create_window(0, 0, window=item_1, anchor='nw')
- item_2 = tk.Frame(canvas, bg='green', width=500, height=500)
- canvas.create_window(500, 500, window=item_2, anchor='nw')
- canvas.configure(yscrollcommand=vsb.set, scrollregion=canvas.bbox("all"))
- #root.after(100, resize)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement