Aikiman
09-28-2011, 07:45 AM
Hey evry1,
As a beginner to Python, noob problems are my life. Im getting the following error when trying to execute the code in Mayas script editor...
# AttributeError: myTestWindow instance has no attribute 'myFunction1' #
Heres the code, I thought I have tried everything and spent over an 2 hours trying to fix it and search the net for an answer and looking at other examples. Im sure its very basic mistake, they usually are :)
import maya.cmds as mc
class myTestWindow:
def __init__(self):
self.name = 'myTest'
self.title = 'Test Window'
def doit(self):
# check for existing window
if (mc.window(self.name, q=1, exists=1)): mc.deleteUI(self.name)
mc.window(self.name, title=self.title, s=1)
# UI components
mc.columnLayout()
mc.button(l='create', c=self.myFunction1())
mc.setParent('..')
# set window width/height
mc.showWindow(self.name)
mc.window(self.name, e=1, wh=[420, 210])
def myFunction1(self):
print 'Hello Help Window'
myTest1 = myTestWindow()
myTest1.doit()
As a beginner to Python, noob problems are my life. Im getting the following error when trying to execute the code in Mayas script editor...
# AttributeError: myTestWindow instance has no attribute 'myFunction1' #
Heres the code, I thought I have tried everything and spent over an 2 hours trying to fix it and search the net for an answer and looking at other examples. Im sure its very basic mistake, they usually are :)
import maya.cmds as mc
class myTestWindow:
def __init__(self):
self.name = 'myTest'
self.title = 'Test Window'
def doit(self):
# check for existing window
if (mc.window(self.name, q=1, exists=1)): mc.deleteUI(self.name)
mc.window(self.name, title=self.title, s=1)
# UI components
mc.columnLayout()
mc.button(l='create', c=self.myFunction1())
mc.setParent('..')
# set window width/height
mc.showWindow(self.name)
mc.window(self.name, e=1, wh=[420, 210])
def myFunction1(self):
print 'Hello Help Window'
myTest1 = myTestWindow()
myTest1.doit()
