Python - capture a Button Click

Smart people ~ Great Scripts
User avatar
DesignDevil
Master Chief Petty Officer
Posts: 500
Joined: 22 May 2009, 08:52
Type the number ten into the box: 0
Location: Neuruppin, Germany, Earth.
Contact:

Re: Python - capture a Button Click

Post by DesignDevil »

Hi clintonman,

the "adjusting of spacing" is a problem in python. If you do it wrong python interprets the code wrong. example:

In Basic you write a IF THEN contruct in this way:

Code: Select all

IF A=B THEN
   Do anything
ELSE
   Do another thing
END IF

Keep going
in python there is no END IF or brackets to tell where the "end is". PYthon needs the spacing to find this out. Example:

Code: Select all

If A==B:
   Do anything
Else:
   Do another thing

Keep going
Wrong is:

Code: Select all

If A==B:
   Do anything
Else:
   Do another thing

   Keep going
in this case is "Keep going under the ELSE construct.

That means if you readjust the spacing for this:

Code: Select all

message_map = {
         win32con.WM_DESTROY: self.OnDestroy
         }
you have to be aware that the inner line is mor inner then the contruct around. Also very importend in python: It is Case Sensitive - sometimes i am also to blind to see. Well, python is a challange in my eyes :)
I still use TrueSpace 6.6
Link: My Youtube Channel
Link: www.DesignDevil.de - Plugins, Tutorials and more about TrueSpace 6.6
Post Reply