PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, November 4, 2022

[FIXED] How can I fix syntax error with tkinter Canvas?

 November 04, 2022     lambda, python     No comments   

Issue

#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?


Solution

Python is case-sensitive. Python keywords must be spelled lowercase. Try lambda e: ...



Answered By - Koviubi56
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing