我如何在类内的函数内调用函数?

时间:2018-07-02 11:24:18

标签: python function class npyscreen

我在代码中有一个问题,一个类的一个函数内有一个函数,我找不到运行第二个函数的方法。

class startFunctionButton(npyscreen.ButtonPress):
    def whenPressed(self):
        IPScanForm.returnData ### Here should the function start

class IPScanForm(npyscreen.NPSApp):
        ip=""
        def main(self):
            f = npyscreen.FormWithMenus(name="Main Menu")
            IPselect = f.add(npyscreen.TitleText,name="IP Address: ")
            convertButtn = f.add(startFunctionButton,name="Start Function")

            def returnData(self): ### the second function
                IPScanForm.ip = IPselect.value ### thats just a placeholder could be anything

0 个答案:

没有答案