如何重用变量

时间:2015-05-07 15:11:16

标签: python qt user-interface pyqt

这是我在PyQt5中的代码:

    def path(self, Interface):
        p= str(QFileDialog.getExistingDirectory(self.pathTab1, 'Directory Path','', QFileDialog.ShowDirsOnly))
        return (p)

    def enableBox(self, Interface, p):
        if p!= '':
            self.chkDedensification.setCheckable(True)

if __name__ == "__main__":
    ui.enableBox(Interface, ??????)

__name__=="__main__"???????所在的位置,我希望/必须使用'p',但如果我只是输入p,则说明它未定义。我可以选择写p='something',但我不知道应该是什么......

我不明白原因。

1 个答案:

答案 0 :(得分:0)

只需致电... TRACK = 'beta' # Can be 'alpha', beta', 'production' or 'rollout' SERVICE_ACCOUNT_EMAIL = ( '148768954062-sp89pjb1blr7cu2f73f4fpd6dqloc047@developer.gserviceaccount.com') # Declare command-line flags. argparser = argparse.ArgumentParser(add_help=False) argparser.add_argument('package_name', help='The package name. Example: com.android.sample') argparser.add_argument('apk_file', nargs='?', default='test.apk', help='The path to the APK file to upload.') ... 即可返回path

p