[Tutor] Adding a (Python) Command Button in Maya

Michiel Duvekot Michiel.Duvekot at autodesk.com
Mon May 14 15:56:18 CEST 2007


> -----Original Message-----
> From: tutor-bounces at python.org 
> [mailto:tutor-bounces at python.org] On Behalf Of Senthil_OR at Dell.com
> Sent: Monday, May 14, 2007 9:31 AM
> To: preecha88 at gmail.com; tutor at python.org
> Subject: Re: [Tutor] Adding a (Python) Command Button in Maya
> From:  Preecha Bundrikwong
> Sent: Monday, May 14, 2007 3:24 PM
> To: tutor at python.org
> Subject: [Tutor] Adding a (Python) Command Button in Maya
> I'm pretty new to Python. I want to add a command button in 
> Maya. Once clicked, it runs Python's script/program. I'm not 
> sure where I should write to ask Python or Maya;
> Answer: Design it in Maya and call it via Python. Thats what 
> I understand in this tutorial on Python Maya Package.
> All the solutions for your questions should be here:
> http://cgkit.sourceforge.net/mayadoc/module-maya.gui.html

Not quite. The site you're referring to is a different project. You
should refer to the Maya manuals for information on how to create menu
items in Python. If you have questions about Maya and Python, a good
place to ask is the Maya forum on the Area
http://discussion.autodesk.com/adskcsp/forum.jspa?forumID=201 (free
registration) or Ask Autodesk at
http://forums.alias.com/WebX?14@@.3bb21e03 (requires Subscription)

To create a button on the shelf, you would MMB-drag a command from the
ScriptEditor's Python tab to the shelf. Here is an example that will
make a button that will open the help docs for the button command.

import maya.cmds as cmds
cmds.help ('button',doc=True)


More information about the Tutor mailing list