logwindow.py 文件源码

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

项目:imagepy 作者: Image-Py 项目源码 文件源码
def __init__(self, title='ImagePy TexLog'):
        wx.Frame.__init__(self, IPy.curapp,title=title,size=(500,300))
        logopath = os.path.join(root_dir, 'data/logo.ico')
        self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO))
        self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) )
        self.title = title
        TextLogManager.add(title, self)
        self.file=''

        ### Create menus (name:event) k-v pairs 
        menus = [
                ## File 
                ('File(&F)',[('Open', self.OnOpen),
                             ('Save', self.OnSave),
                             ('Save as', self.OnSaveAs),
                             ('-'),
                             ('Exit', self.OnClose)
                             ]),
                ## Edit 
                ('Edit(&E)', [ ('Undo', self.OnUndo),
                             ('Redo', self.OnRedo),
                             ('-'),
                             ('Cut', self.OnCut),
                             ('Copy', self.OnCopy),
                             ('Paste', self.OnPaste),
                             ('-'),
                             ('All', self.OnSelectAll)
                             ]),               
                ## Help 
                ('Help(&H)', [('About', self.OnAbout)])
        ]

        ### Bind menus with the corresponding events 
        self.menuBar=wx.MenuBar()
        for menu in menus:
            m = wx.Menu()
            for item in menu[1]:
                if item[0]=='-':
                    m.AppendSeparator()
                else:
                    i = m.Append(-1, item[0])
                    self.Bind(wx.EVT_MENU,item[1], i)
            self.menuBar.Append(m,menu[0])
        self.SetMenuBar(self.menuBar) 
        self.Bind(wx.EVT_CLOSE, self.OnClosing)

        sizer = wx.BoxSizer( wx.VERTICAL )
        self.text= wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, 
                                wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
        sizer.Add( self.text, 1, wx.ALL|wx.EXPAND, 1 )
        self.SetSizer( sizer )

        self.Bind(wx.EVT_RIGHT_DOWN,self.OnRClick)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号