PDA

View Full Version : Query an intSliderGrp in Python


tostao_wayne
09-23-2009, 08:11 AM
Hello, i've been scripting for a long time in MEL and now i'm trying to start scripting in Python.

but i have not find any documentation in maya's helps about how is the sintaxis to query the value of a intSliderGrp.

here my script:

import maya.cmds as cmds




def Seleccionar(*args):print 'Procesar was pushed.'



# here i must to specify the name of the slider, but how
# in MEL is easy int $percent = `floatSliderGrp -query -value Perc`
# where i must to put "Perc" and how
percent = cmds.intSliderGrp (query=True, value=True)




Div_Mesh = cmds.window(title="Dividir mesh", widthHeight=(280, 100), s=1)


cmds.columnLayout
# Definir los ejes y la tolerancia
HPlace = cmds.frameLayout (w=285, bs="etchedIn", borderVisible=1, labelVisible=1, labelAlign="center", marginWidth=5, marginHeight=5, label="Definir el porcentaje", cll=1)
cmds.columnLayout()

Perc = cmds.intSliderGrp (label="N. porciones", field=1, maxValue=10, value=1, cal=(1, "left"), cw3=(80, 50, 100))
cmds.text (" ")
cmds.button (w=270, h=20, label="Procesar", command=Seleccionar)

cmds.showWindow (Div_Mesh);





please can anybody tell me where and how i must to specify the name of the slider

mlefevre
09-23-2009, 08:47 AM
import maya.cmds as cmds
if cmds.window('testwin', exists=True):
cmds.deleteUI('testwin')

cmds.window('testwin')
cmds.columnLayout('testcol')
cmds.intSlider('testSlider')
cmds.showWindow('testwin')

cmds.intSlider('testSlider', query=True, value=True)

tostao_wayne
09-23-2009, 10:14 AM
thnkx mlefevre, now it works





import maya.cmds as cmds
if cmds.window('testwin', exists=True):
cmds.deleteUI('testwin')

cmds.window('testwin')
cmds.columnLayout('testcol')
cmds.intSlider('testSlider')
cmds.showWindow('testwin')

cmds.intSlider('testSlider', query=True, value=True)

CGTalk Moderation
09-23-2009, 10:14 AM
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.