if(event==EVENT_EXPORT):
# print self.mWhatExport
if self.mWhatExport.val == 1:
objects = Object.GetSelected()
print "Exporting only selected"
else:
objects = self.mScene.getChildren()
print "Exporting *ALL*"
osg_export = OSGExport(self.mFilename.val, self.mScene, self.mLoopMode.val, self.mMeshAnim.val, self.mFPS.val, objects)
osg_export.export()
if event==EVENT_DONE:
self.ExitGUI()
Trying Python
Hi, I'm trying to learn python
From the looks of it, there is a if statement and at the end of the line there is a ":".
But where does the "if" block end?
In C++, a block starts with { and ends with }
If you don't put the brackets, then only the line following the if is part of the block.
Same problem for the part after the "else"
Python's leading whitespace is significant.
You might want to check out a book or website like Dive Into Python. Learning just from reading code might be hard.
if something: will execute this line and this line and this linebut not this lineif something else: again with the executing this lineelse: else will execute this line and this line and this linebut not this line
You might want to check out a book or website like Dive Into Python. Learning just from reading code might be hard.
From what I know, Python uses the indentation itself to determine where control blocks start and end. So, when you are finished writing your if block, simply return to the lower level of indentation.
Note: I have not used Python much, this is mainly what I understand from others.
if condition: condition_true_statement_1 condition_true_statement_2unconditional_statement
Note: I have not used Python much, this is mainly what I understand from others.
Blocks of code are indicated by indentation instead of being surrounded by '{' and '}'.
a = 1if a == 1: print "A is 1"else: print "A is not 1"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement