hey every
i am trying to write a ui class and the trying to querry it from the
instance that i created but i keep on getting error here is an example
please let me know if what i am trying to do is possible
save this in C:\Users\u-user\Documents\maya\2016\scripts
## -*-coding:UTF-8-*
##Test
import os
import maya.mel as mel
import maya.cmds as cmds
UIElements={}
class VgsRigTools:
def __init__(self,WndNme,fml,width,height):
self.WndNme=WndNme
self.fml=fml
self.wdh=width
self.hgt=height
if cmds.window(self.WndNme,exists=True):
cmds.deleteUI(self.WndNme)
UIElements["windowName"]=cmds.window(self.WndNme,t=self.WndNme,mxb=False,mnb=False,sizeable=True,w=self.wdh,h=self.hgt)
UIElements["Fma"]=cmds.formLayout(self.fml,w=self.wdh,h=self.hgt)
cmds.showWindow(self.WndNme)
def Button(self,btnName,width,height,top,left):
self.btnName=btnName
self.btnWdt=width
self.btnHgt=height
self.btnTop=top
self.btnLft=left
UIElements["btnA"]=cmds.button(l=self.btnName,w=self.btnWdt,h=self.btnHgt,p=self.fml)
cmds.formLayout(self.fml,e=True,af=[(UIElements["btnA"],"top",self.btnTop),(UIElements["btnA"],"left",self.btnLft)])
def chkBox(self,chkName,chkTop,chkLft):
self.chkName=chkName
self.chkTop=chkTop
self.chkLft=chkLft
UIElements["ChkA"]=cmds.checkBox( label=self.chkName )
cmds.formLayout(self.fml,e=True,af=[(UIElements["ChkA"],"top",self.chkTop),(UIElements["ChkA"],"left",self.chkLft)])
and then i tried the below script from maya but i was not able to querry
the check box
from ClassTest import VgsRigTools
vrt=VgsRigTools
vrt=VgsRigTools('RigTools','RigLayout',400,100)
vrt.Button('ButtonA',50,20,10,0)
chkBx=vrt.chkBox('chktst',30,300)
cmds.checkBox(chkBx,q=True,v=True)
vrt.Button('ButtonB',50,20,50,0)
this is the error i got
# Error: RuntimeError: file <maya console> line 6: No object name specified.
i know why i am getting the error but i have no idea how to fix it any help
would be deeply appreciated
Thank you
sumanth :D
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/b3c698ac-8e6d-4468-b697-233be2cecb27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.