首页 > 解决方案 > 如何在类内的函数内调用函数?

问题描述

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

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

标签: pythonfunctionclassnpyscreen

解决方案


推荐阅读