address_book_app.py 文件源码

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

项目:IntroPython2016a 作者: UWPCE-PythonCert 项目源码 文件源码
def __init__(self, add_book, *args, **kwargs):
        """
        initilizer for the main from for the AddressBook app.

        :param add_book: the address book class to manipulate
        :type add_book: A address_book_data.AddressBook instance

        """

        kwargs.setdefault('title', "Micro Address Book")
        wx.Frame.__init__(self, *args, **kwargs)

        self.add_book = add_book
        self.current_index = 0

        # creae a status bar for messages...
        self.CreateStatusBar()

        # create the entryPanel
        self.entryPanel = AddBookForm(add_book.book[self.current_index], self)

        # put them in a Sizer to lay out
        S = wx.BoxSizer(wx.VERTICAL)
        S.Add(wx.StaticLine(self,style=wx.LI_HORIZONTAL), 0, wx.EXPAND)
        S.Add(self.entryPanel, 0, wx.ALL|wx.EXPAND, 4)
        S.Add((1,5))
        S.Add(wx.StaticLine(self,style=wx.LI_HORIZONTAL), 0, wx.EXPAND)

        self.SetSizerAndFit(S)

        # Build up the menu bar:
        menuBar = wx.MenuBar()

        fileMenu = wx.Menu()

        closeMenuItem = fileMenu.Append(wx.ID_EXIT, "&Close", "Close the file" )
        self.Bind(wx.EVT_MENU, self.onClose, closeMenuItem)

        exitMenuItem = fileMenu.Append(wx.ID_EXIT, "Exit", "Exit the application")
        self.Bind(wx.EVT_MENU, self.onExit, exitMenuItem)
        menuBar.Append(fileMenu, "&File")

        helpMenu = wx.Menu()
        helpMenuItem = helpMenu.Append(wx.ID_HELP, "Help", "Get help")
        menuBar.Append(helpMenu, "&Help")

        self.SetMenuBar(menuBar)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号