In your documentMaker
class, change the test
method to a @staticmethod
:
class documentMaker():
@staticmethod
def test(cls):
print ("hello people")
Then your saveButton
's command can be:
command = documentMaker.test
A staticmethod
is bound to the class, not to an instance of the class like an instance method. So, we can call it from the class's name directly. If you did not want it to be a staticmethod
, you could keep it an instance method and have the command line change to:
command = documentMaker().test
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…