#Create a Main Frame
main_frame = Frame(root)
main_frame.pack(fill=BOTH, expand=1)
#Create a Canvas
canvas = Canvas(main_frame)
canvas.pack(side=LEFT, fill=BOTH, expand=1)
#Add a ScrollBar
scrollbar = ttk.Scrollbar(main_frame, orient=VERTICAL, command=canvas.yview)
scrollbar.pack(side=RIGHT, fill=Y)
#Configure the Canvas
canvas.configure(yscrollcommand=scrollbar.set)
canvas.bind('<Configure>',Lambda e: canvas.configure(scrollregion=canvas.bbox('all')))
#Create the Second Frame
second_frame = Frame(canvas)
#Add new Frame to Window in the Canvas
canvas.create_window((0.0), window=second_frame, anchor='nw')
This is a part of my script. How you can see, I tried to create a scrollbar, but when I configure my canvas with canvas.bind
, Idle gives me a syntax error in Lambda e
:
I think it doesn't accept the colon. How can I fix this error?
CodePudding user response:
Python is case-sensitive. Python keywords must be spelled lowercase. Try lambda e: ...