Code Panel

Code panel is located behind the canvas and used for displaying and editing Python code. When you create objects via GUI, Mekanimo automatically generates the corresponding code. If you modify this automatically generated code (auto-code) and go back to the canvas, Mekanimo modifies the model accordingly. This way the code displayed and the model shown are always in sync.

code_panel

Figure 2: Code panel

Versions

Settings

Mekanimo uses wx.stc.StyledTextControl (STC) as code editor. Some of the commonly used editor settings can be changed from the View menu. If you need to change any other STC settings, you can access the STC object from the interpreter as shown below.

>>> stc = frame.codePage.editor
>>> stc.SetCaretForeground(color.green)

Note

You can access the wx.stc.StyledTextControl reference from http://www.wxpython.org/docs/api/wx.stc.StyledTextCtrl-class.html

Indentation guides

When your code gets longer sometimes it is not easy to see if the indentation is consistent in the code blocks. Indentation guides help you visualize the indentation levels.

White space

In Python statement grouping is done by indentation (white space is significant when used in code blocks), you may want to see the white space characters.The code editor converts tab characters to four spaces by default. When you copy and paste code snippets from web pages or other sources you may inadvertantly end up with mixed tabs and spaces which could cause errors. Viewing white spaces can resolve these problems.

End of line (EOL) characters

When you paste code into the code editor from a different source, EOL characters may cause problems. To see if the appropriate EOL character is used you can view the EOL characters in the editor from View -> End of line characters menu.

Find and replace

Comment/Uncomment block

Indent/Dedent block

Compress

Table Of Contents

Previous topic

Canvas

Next topic

Object Tree

This Page