在Python2.7中,我有一个类似这样的代码:class App(ttk.frame):
def __init__(self, master=None):
ttk.Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.okButton = ttk.Button(self, text = "OK", command = self.function2)
self.okButton.grid(column = 1, row = 1)
def function1(self, arg1, arg2): # function create fields in frame
self.arg1 = arg1
self.arg2 = arg2
def function2(self): #function calcule things with values of fields when Ok button is click
doing_thing_to(x, y, z, w)
app = App()
app.function1("x", "y") # Create first field
app.function1("z", "w") # Create another field
mainloop()
当调用函数名为2时,不定义全局名称。在
我试着把
^{pr2}$
但有相同的错误。在
我试着把return arg1, ar