【发布时间】:2014-03-11 15:01:48
【问题描述】:
我正在自学 Python/wxPython,所以提前为我的问题的新手性质和任何不正确的术语道歉。
我在这里搜索了网络和其他建议的答案,但似乎找不到我要找的东西。
我有以下按钮,它返回一个打开的文件 (.txt) 对象:
def onHydroInputButton(self, event):
dlg = wx.FileDialog(self, "Select file", self.dirname, "", "*.*", wx.OPEN)
if dlg.ShowModal() == wx.ID_OK:
input1 = open(dlg.GetPath())
dlg.Destroy()
return input1
我想在另一个函数中使用 input1。谁能告诉我怎么做?
for line in input1:
很明显会抛出input1未定义的错误。
提前致谢。
【问题讨论】:
标签: python function button wxpython return