码迷,mamicode.com
首页 > 其他好文 > 详细

简单的文本编辑器

时间:2014-07-07 17:37:18      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   color   for   io   

#!/usr/bin/env python
import wx

class MainWindow(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title, size=(200,100))
        self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
        self.CreateStatusBar() # A Statusbar in the bottom of the window

        # Setting up the menu.
        filemenu= wx.Menu()

        # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.
        aboutItem=filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
        self.Bind(wx.EVT_MENU, self.About, aboutItem)
        filemenu.AppendSeparator()
        exitItem=filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")
        self.Bind(wx.EVT_MENU,self.Exit,exitItem)

        # Creating the menubar.    
        menuBar = wx.MenuBar()
        menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar
        self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.
        self.Show(True)
        
    def About(self,Event):
        dlg=wx.MessageDialog(self,"A small text editor","about  sample editor",wx.OK)
        dlg.ShowModal()
        dlg.Destroy()
        
        
if __name__==__main__:
    app = wx.App(False)
    frame = MainWindow(None, "Sample editor")
    app.MainLoop()

 

简单的文本编辑器,布布扣,bubuko.com

简单的文本编辑器

标签:des   style   blog   color   for   io   

原文地址:http://www.cnblogs.com/canbefree/p/3813634.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!