On Mon, Nov 30, 2015 at 7:44 PM, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: > On Mon, 30 Nov 2015 10:55:23 -0800 (PST), fl <rxjw...@gmail.com> declaimed > the following: > >>Thanks Ian. I created the class because I want to use the original example >>line >> >> UI.Button("button %s" % i, callback) >> >>Is there another way to use the above line without my class definition? >>I do feel that my created class does not match well with the above line >>because the first item "button %s" does not fit __self__ in the class. > > The first item passed to a method call is the instance object... In > this case, whatever "UI" is bound to. > > If it helps, think of > > UI.Button("string", callback) > as > Button(UI, "string", callback)
This is only correct if "UI" is bound to an instance of a class and "Button" is a method of that class. If UI is a class itself or a module, then those are not equivalent. -- https://mail.python.org/mailman/listinfo/python-list