import maya.cmds as cmds
if mc.window(ram, exists =True):
mc.deleteUI(ram)
ram = cmds.window("RenamerWin",t = "Renamer Tool", w=300, h=300)
cmds.columnLayout(adj = True)
cmds.text("Welcome to the tool renamer")
cmds.separator(h=10)
cubW = cmds.intSliderGrp(1 = "Width",min =0, max =10, field =True)
cubH = cmds.intSliderGrp(1 = "Height",min =0, max =10, field =True)
cubD = cmds.intSliderGrp(1 = "Depth",min =0, max =10, field =True)
cmds.button(l = "Create a Cube",c="myCube()")
cmds.showWindow(ram)
def myCube():
myCubeWidth = cmds.intSliderGrp(cubW , q= True,value =True)
myCubeHeight = cmds.intSliderGrp(cubH , q= True,value =True)
myCubeDepth = cmds.intSliderGrp(cubWD , q= True,value =True)
finalCube = cmds.polyCube(w=myCubeWidth,h=myCubeHeight,d=myCubeDepth , n = "myCube")
The first thing I noticed is that you are using "cmds" in most of your code, but at the very top, you are using "mc".
Also, the line "if mc.window(ram, exists =True):" won't work until "ram" has been defined. So you have to execute this line at least once: "ram = cmds.window("RenamerWin",t = "Renamer Tool", w=300, h=300)"