Why is button parameter “command” executed when declared?



Why is button parameter “command” executed when declared?..

Answer / Kishore

In Tkinter, a Python library for creating GUI applications, the 'command' parameter of a button widget is executed immediately upon declaration if a function or lambda expression is provided. This happens because Tkinter processes all the events (like clicking a button) in the background as soon as they are bound to their respective events. If you don't want the command to be executed right away, you can delay it by placing the code for the command inside a function.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What is format () in python?

1 Answers  


What is Python Decorator?

1 Answers  


Tell us what is the usage of help() and dir() function in python?

1 Answers  


What is dogpile mechanism? Explain.

1 Answers  


What is the shortest method to open a text file and display its content?

1 Answers  


Is node better than python?

1 Answers  


What is python interpreter?

1 Answers  


What is zip() function in python?

1 Answers  


Point out the use of help() function?

1 Answers  


Is r easier than python?

1 Answers  


What are dict and list comprehensions?

1 Answers  


How would you define a block in python?

1 Answers  


Categories