address_book_app.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:IntroPython2016a 作者: UWPCE-PythonCert 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号