CGTalk > Technical > Graphics Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 12-14-2008, 02:41 AM   #1
New Member
stockholm, Sweden
Join Date: Dec 2008
Posts: 1
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 :

Old 12-16-2008, 02:10 AM   #2
Luke Olson
Dallas, USA
Join Date: Jan 2007
Posts: 2,925
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!
Old 12-18-2008, 11:56 AM   #3
peanut junkie
kjaft's Avatar
Felix Ulber
Developer / cgi Pro
[0x1] Software and Consulting
Hamburg, Germany
Join Date: Apr 2003
Posts: 224
Send a message via ICQ to kjaft
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
Old 12-19-2008, 10:26 PM   #4
FX / Lighting / Pipeline
skeelogy's Avatar
Skeel Lee
Join Date: Jun 2008
Posts: 29
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): mc.deleteUI("myWindow") #create the window mc.window("myWindow", title="Create stones", wh=(500, 270), sizeable=False) #create layout mc.frameLayout(marginHeight=5, marginWidth=5, labelVisible=False) mc.columnLayout() #create the size field mc.text(label="Size") mc.floatField(min=0, max=10, step=0.1, precision=1) mc.separator(h=10, style="none") #create the quantity field mc.text(label="Qty") 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.text(label="Roughness") 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 mc.showWindow("myWindow") createUi()

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!
Old 12-19-2008, 10:26 PM   #5
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,479
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:03 AM.

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