Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

How to print the value of intField in Maya python

How to print the value of intField in Maya python

Anonymous
Not applicable
2,893 Views
4 Replies
Message 1 of 5

How to print the value of intField in Maya python

Anonymous
Not applicable

I want to print the value of intField given by user in maya using python.

 

code

 

import maya.cmds as cmds

 

def fun(number):
  print(number)

 

cmds.window()
cmds.columnLayout()
num = cmds.intField(changeCommand = 'fun()')
cmds.showWindow()

 

 

 

User will enter value in intField and i want to print that value

0 Likes
Accepted solutions (1)
2,894 Views
4 Replies
Replies (4)
Message 2 of 5

rajasekaransurjen
Collaborator
Collaborator
Accepted solution

Hi,

Try this.

 

import maya.cmds as cmds

def fun():
    number = cmds.intField(num, q=1, v=1)
    print(number)

cmds.window()
cmds.columnLayout()
num = cmds.intField(changeCommand = 'fun()')
cmds.showWindow()

 

 

Hope this will help.

 

Best Regards,

Rajasekaran

Message 3 of 5

Anonymous
Not applicable

thanks for quick solution .can you tell me what is q=1 and v= 1  ?

0 Likes
Message 4 of 5

rajasekaransurjen
Collaborator
Collaborator

q = Query mode.

V= Value of the field.

 

Using the above flags we querying the value of the field. Refer...

 

https://help.autodesk.com/cloudhelp/2017/ENU/Maya-Tech-Docs/CommandsPython/intField.html

Message 5 of 5

Anonymous
Not applicable

thanks !

0 Likes