binding

pradeep k wrote:

I have attached 2 files fourth.py and testfourth.py. fourth.py works just fine by
creating a button and linking an event to it. testfourth.py tries to replicate the
same behaviour, but i get some error. Somebody please help me.

The error message tells you that the function is defined with two arguments but the calling statement in the event loop has passed only one argument. Functions that are defined in the main program do not have "self" as an argument. (You correctly removed "self" from the Bind functions.)

In general, event handlers need to share data. In your first example they can use "self" to access common data within the AnyFrame object. In the second example you would need to use global variables.

Since the second example only makes sense as a main program the "if" statement is pointless.

Christopher Thoday
Software Engineer