Hi,

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

=====================

#!/usr/bin/python3
from tkinter import *
main=Tk()

# as I understand it this will create an instance of the button widget called b1 b1=Button(main, text='instantce', command= lambda b='goodbye' : print(b)).grid(row=1, column=0)


# but here I haven't made an instance, but all seems well
Button(main, text='test1', command=lambda a='hello' :print(a)).grid(row=0, column=0)

main.mainloop()


=======================

any explanation gratefully recieved

Regards, Chris ROy-Smith

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to