zoukankan      html  css  js  c++  java
  • 简单的文本编辑器

    #!/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()
  • 相关阅读:
    spring-schedule
    数字电路
    面试题
    CMOS集成门电路
    TTL特殊门电路
    TTL反相器的外部特性
    TTL集成门电路工作原理和电压传输特性
    半导体器件的开关特性和分立元件门电路
    逻辑函数的公式化减法
    php 获取当前文件名称
  • 原文地址:https://www.cnblogs.com/canbefree/p/3813634.html
Copyright © 2011-2022 走看看