如何重用变量
How to re-use variable
这是我在 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__"
中 ???????
所在的位置,我 want/have 使用 'p',但如果我只输入 p
,它会说它没有定义。我可以选择写 p='something'
,但我不知道应该写什么....
我不明白原因。
只需调用 path
其中 returns p
。
if __name__ == "__main__":
ui.enableBox(Interface, ui.path(Interface))
这是我在 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__"
中 ???????
所在的位置,我 want/have 使用 'p',但如果我只输入 p
,它会说它没有定义。我可以选择写 p='something'
,但我不知道应该写什么....
我不明白原因。
只需调用 path
其中 returns p
。
if __name__ == "__main__":
ui.enableBox(Interface, ui.path(Interface))