Doc:Tutorials/Extensions/Python/BSoD/Text Editor

From BlenderWiki

Jump to: navigation, search
Blender Summer of Documentation: Contents | Manual | Blender Version 2.41

[edit] General Description

Blender comes with a built-in text editor - the Text Editor window. Originally designed for making notes about a .blend file, it has evolved into a Python programming editor.

The Text Editor uses both menus and hot keys. It will be familiar to anyone who has ever edited a document.

A complete reference to the Text Editor is here: http://mediawiki.blender.org/index.php/Reference/Windows/Text. Go look at it now!

[edit] Python specific features

Most are under the Format menu.

  • Comment / UnComment
    useful for creating blocks of comments or for temporarily disabling blocks of code.. Select the text to be commented (uncommented) and choose from the menu.
  • Indent /Unindent
    Python uses indentation to structure code. These commands change the indentation level. Like Comment/Uncomment, select the text and choose from the menu

[edit] Hints

  • Do NOT mix spaces and tabs. Use one or the other. The requirement for all bundled scripts is tabs.
  • To run a Python script, use either File->Run Python Script or press Alt P
  • the error message SyntaxError: invalid syntax is often caused by improper indentation.