Python in Maya

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  12 December 2008
Smile Python in Maya

Hi everyone! i need help with a problem that i cant solve, im new to python.

i need to create a window like this in maya using python. Anyone who knows how to to the regulators, the controls as you se in this pic below :

  12 December 2008
I'm just starting out with Python in Maya and haven't gotten that far yet. A guy I used to work with used Tkinter to make GUIs in Maya with Python. It sounds right from what I remember but I could be wrong, its been quite a few months and was just getting into Python itself at the time. Cheers!
  12 December 2008
No need to use any external UI kit. Thats very basic Maya UI stuff, please read the acording chapter in the Maya documentation (under the MEL section). The docs are concerned to mel, but the commands are the same in python.

BTW: This topic should be posted in the Maya Programming forum!
my webfolio
  12 December 2008
Hi fabiotoni,

The following Python script should give you enough information to get you started:

import maya.cmds as mc
def createStoneFunction(*args):
	print "do whatever that is necessary to create the stones here"
def createUi():
	#check for existing window first
	if mc.window("myWindow", exists=True):
	#create the window
	mc.window("myWindow", title="Create stones", wh=(500, 270), sizeable=False)
	#create layout
	mc.frameLayout(marginHeight=5, marginWidth=5, labelVisible=False)
	#create the size field
	mc.floatField(min=0, max=10, step=0.1, precision=1)
	mc.separator(h=10, style="none")
	#create the quantity field
	mc.intField(min=0, max=100)
	mc.separator(h=10, style="none")
	#create the soft select fall off field/slider
	mc.text(label="Soft Select Fall off")
	mc.floatSliderGrp(field=True, minValue=0.0, maxValue=10.0, fieldMinValue=-0.0, fieldMaxValue=10.0, value=0)
	mc.separator(h=10, style="none")
	#create the roughness field/slider
	mc.floatSliderGrp(field=True, minValue=0.0, maxValue=10.0, fieldMinValue=-0.0, fieldMaxValue=10.0, value=0)
	mc.separator(h=10, style="none")
	#create the button
	mc.button(label="Create Stones", command=createStoneFunction)
	#finally, show the window

If you need to know what other ui controls are available and their corresponding attributes, you may want to refer to the "Python Command Reference" under the Help menu, as kjaft has suggested.

And yes, you don't need to use Tkinter to do a UI like this in Maya, since Maya has its own set of functions to create UI. Tkinter is mostly used for creating UI outside of Maya, such as creating a window with buttons in Vista (or whatever OS you are running on).

Hope this helps!
  12 December 2008
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 09:34 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.