def onOpen(self, evt=None):
"""This method opens an existing file"""
dlg = wx.FileDialog(
self, message="Choose a file",
defaultDir=os.getcwd(),
defaultFile="",
wildcard="*.json",
style=wx.OPEN | wx.CHANGE_DIR
)
# Show the dialog and retrieve the user response. If it is the OK response,
# process the data.
if dlg.ShowModal() == wx.ID_OK:
# This returns a Python list of files that were selected.
path = dlg.GetPath()
print "I'd be opening file in onOpen ", path
self.add_book.load_from_file(filename=path)
else :
print "The file dialog was canceled"
dlg.Destroy()
address_book_app.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录