[Tutor] why can use a widget assigned to a variable or just use it on it's own?
chris_roysmith at internode.on.net
Sun Jul 1 21:54:08 EDT 2018
I'm trying to understand working with objects.
If I have grasped things correctly a widget is an object. So why can I
assign the widget, or use it stand alone? See sample code below
from tkinter import *
# as I understand it this will create an instance of the button widget
b1=Button(main, text='instantce', command= lambda b='goodbye' :
# but here I haven't made an instance, but all seems well
Button(main, text='test1', command=lambda a='hello'
any explanation gratefully recieved
Regards, Chris ROy-Smith
More information about the Tutor