2009

Table Of Contents
You can create fully customized user interfaces with MEL scripting. There are
additional user interface elements not covered in this lesson.
For a full list of user interface elements, look in the MEL Command Reference.
You can open the MEL command reference by selecting Help > MEL Command
Reference from the menu bar. User interface commands are in the Windows
category of the MEL Command Reference.
Lesson 5: Using Python in Maya
Introduction
Python scripting in Maya is very similar to MEL scripting. Python scripting
has the same access MEL does to Maya functionality with very few limitations
(see Current limitations of the Python guide). Python requires a different
syntax than MEL, so commands in Python can look very different from their
MEL equivalents.
This tutorial is for migrating your MEL scripting experience to a Python
scripting environment in Maya. This lesson does not teach Python, only how
to use Python scripting in Maya. Maya uses Python 2.5 on all supported
platforms.
Python is a highly readable, easy to maintain, high level programming
language. Python is widely used in industry due to its simplicity and standard
libraries.
To learn Python, try a Getting Started tutorial in Python:
http://www.python.org/about/gettingstarted/www.python.org/about/gettingstarted/
In this lesson, you learn how to:
Enter Python commands in Maya
Create geometry with Python scripting commands
Return values from Python commands
Use flags in Python with the move, scale and rotate commands
Set the edit and query flags in Python
Refer to named objects in Python
Transfer values between Python and MEL
644 | Chapter 13 Scripting in Maya