def __init__(self, parent, id):
     """Create a frame instnace and display image"""
     wx.Frame.__init__(self, parent,id,'Toolbars', size=(300, 200))
     panel = wx.Panel(self)  # 创建画板
     panel.SetBackgroundColour('White')
     statusBar = self.CreateStatusBar()  # 创建状态栏
     toolbar = self.CreateToolBar()  # 创建工具栏
     # 给工具栏增加一个工具
     toolbar.AddSimpleTool(wx.NewId(), images.getPyBitmap(), 'New', "Long help for 'New'")
     toolbar.Realize()  # 准备显示工具栏
     menuBar = wx.MenuBar()  # 创建一个菜单栏
     # 创建两个菜单
     menu1 = wx.Menu()
     menuBar.Append(menu1, '&File')
     menu1.Append(-1, "&Open...", 'Open new file')
     menuItem = menu1.Append(-1, "&Exit...", 'Exit System')
     # 菜单项绑定事件
     self.Bind(wx.EVT_MENU, self.OnCloseMe, menuItem)
     menu2 = wx.Menu()
     # 创建菜单项MenuItem
     menu2.Append(wx.NewId(), '&Copy', 'Copy in status bar')
     menu2.Append(wx.NewId(), '&Cut', '')
     menu2.Append(wx.NewId(), '&Paste','')
     menu2.AppendSeparator()
     menu2.Append(wx.NewId(), '&Options', 'Display Options')
     menuBar.Append(menu2, '&Edit')  # 在菜单栏上附上菜单
     self.SetMenuBar(menuBar)  # 在Frame上面附加菜单
Example #2
0
	def InitToolBar(self):
		# 创建工具栏,自动放置在框架的顶部
		toolBar = self.CreateToolBar()
		# 给工具栏增加一个工具
		toolBar.AddSimpleTool(wx.NewId(), images.getPyBitmap(), "New", "Long help for 'New'")
		# 准备显示工具栏
		toolBar.Realize()
Example #3
0
    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, 'Toolbars', size=(300, 200))
        panel = wx.Panel(self)
        panel.SetBackgroundColour('White')
        statusBar = self.CreateStatusBar()  # 1 创建状态栏
        toolbar = self.CreateToolBar()  # 2 创建工具栏
        toolbar.AddSimpleTool(wx.NewId(), images.getPyBitmap(), 'New',
                              "Long help for 'New'")  # 3 给工具栏增加一个工具
        toolbar.Realize()  # 4 准备显示工具栏
        menuBar = wx.MenuBar()  # 创建菜单栏
        # 创建两个菜单
        menu1 = wx.Menu()
        menuBar.Append(menu1, '&File')
        menu2 = wx.Menu()
        # 6 创建菜单的项目
        menu2.Append(wx.NewId(), '&Copy', 'Copy in status bar')
        menu2.Append(wx.NewId(), 'C&ut', '剪切')

        menu2.Append(wx.NewId(), 'Paste', '粘贴')
        menu2.AppendSeparator()
        menu2.Append(wx.NewId(), '&Options...', 'Display Options')
        menuBar.Append(menu2, '& Edit')  # 在菜单栏上附上菜单

        # 自己加一些代码
        menu3 = wx.Menu()
        menu3.Append(wx.NewId(), 'version', 'version info')
        menu3.Append(wx.NewId(), 'register', 'register info')
        menuBar.Append(menu3, '& Version')

        self.SetMenuBar(menuBar)  # 在框架上附上菜单栏
    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, 'Toolbars', size=(300, 200))
        panel = wx.Panel(self)
        panel.SetBackgroundColour("White")  # 背景调成白色
        statusBar = self.CreateStatusBar()  # 创建状态栏
        toolbar = self.CreateToolBar()  # 创建工具栏
        # 给工具栏添加一个工具
        toolbar.AddSimpleTool(wx.NewId(), images.getPyBitmap(), "New",
                              "Long help for New")
        toolbar.Realize()  # 显示工具栏
        menuBar = wx.MenuBar()  # 创建菜单栏

        # 创建两个菜单栏
        menu1 = wx.Menu()
        menuBar.Append(menu1, " 1")  # 在菜单栏上添加菜单
        menu2 = wx.Menu()

        # 菜单内添加选项
        # 参数分别是(ID,选项的文本,鼠标停留时显示在状态栏的文本)
        menu2.Append(wx.NewId(), "ahah ", "Copy in status bar")
        menu2.Append(wx.NewId(), "C", "123")
        menu2.Append(wx.NewId(), "Paste", "456")
        menu2.AppendSeparator()
        menu2.Append(wx.NewId(), "okay", "Display Options")
        menuBar.Append(menu2, " 2")
        self.SetMenuBar(menuBar)
Example #5
0
    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, 'Toolbars', size=(300, 200))
        panel = wx.Panel(self)
        panel.SetBackgroundColour('White')
        statusBar = self.CreateStatusBar()  #1 创建状态栏
        toolbar = self.CreateToolBar()  #2 创建工具栏
        toolbar.AddTool(toolId=wx.NewIdRef(),
                        bitmap=images.getPyBitmap(),
                        label="New",
                        kind=wx.ITEM_NORMAL)  #3 给工具栏增加一个工具
        toolbar.Realize()  #4 准备显示工具栏
        menuBar = wx.MenuBar()  # 创建菜单栏
        # 创建两个菜单
        menu1 = wx.Menu()
        menuBar.Append(menu1, "&File")
        menu2 = wx.Menu()
        #6 创建菜单的项目
        copys = menu2.Append(wx.NewIdRef(), "&Copy", "Copy in status bar")
        menu2.Append(wx.NewIdRef(), "C&ut", "")
        paste = menu2.Append(wx.NewIdRef(), "Paste", "")
        menu2.AppendSeparator()
        option = menu2.Append(wx.NewIdRef(), "&Options...", "Display Options")
        menuBar.Append(menu2, "&Edit")  # 在菜单栏上附上菜单
        self.SetMenuBar(menuBar)  # 在框架上附上菜单栏

        self.Bind(wx.EVT_MENU, self.mas, copys)
        self.Bind(wx.EVT_MENU, self.mass, paste)
        self.Bind(wx.EVT_MENU, self.masss, option)
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
Example #6
0
    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, 'Toolbars',
                          size=(300, 200))
        panel = wx.Panel(self, -1)
        panel.SetBackgroundColour('White')
        statusBar = self.CreateStatusBar()
        toolbar = self.CreateToolBar()
        toolbar.AddTool(wx.NewIdRef(), "New", images.getPyBitmap(),
                        "Long help for 'New'")
        toolbar.Realize()
        menuBar = wx.MenuBar()
        menu1 = wx.Menu()
        menuBar.Append(menu1, "&File")
        menu2 = wx.Menu()
        menu2.Append(wx.NewIdRef(), "&Copy", "Copy in status bar")
        menu2.Append(wx.NewIdRef(), "C&ut", "")
        menu2.Append(wx.NewIdRef(), "Paste", "")
        menu2.AppendSeparator()
        menu2.Append(wx.NewIdRef(), "&Options...", "Display Options")
        menuBar.Append(menu2, "&Edit")

        menu3 = wx.Menu()
        shell = menu3.Append(-1, "&wxPython shell",
                             "Open wxPython shell frame")
        filling = menu3.Append(-1, "&Namespace viewer",
                               "Open namespace viewer frame")
        menuBar.Append(menu3, "&Debug")
        self.Bind(wx.EVT_MENU, self.OnShell, shell)
        self.Bind(wx.EVT_MENU, self.OnFilling, filling)
        self.SetMenuBar(menuBar)
Example #7
0
 def __init__(self, parent, id):
     """Create a frame instnace and display image"""
     wx.Frame.__init__(self, parent, id, 'Toolbars', size=(300, 200))
     panel = wx.Panel(self)  # 创建画板
     panel.SetBackgroundColour('White')
     statusBar = self.CreateStatusBar()  # 创建状态栏
     toolbar = self.CreateToolBar()  # 创建工具栏
     # 给工具栏增加一个工具
     toolbar.AddSimpleTool(wx.NewId(), images.getPyBitmap(), 'New',
                           "Long help for 'New'")
     toolbar.Realize()  # 准备显示工具栏
     menuBar = wx.MenuBar()  # 创建一个菜单栏
     # 创建两个菜单
     menu1 = wx.Menu()
     menuBar.Append(menu1, '&File')
     menu1.Append(-1, "&Open...", 'Open new file')
     menuItem = menu1.Append(-1, "&Exit...", 'Exit System')
     # 菜单项绑定事件
     self.Bind(wx.EVT_MENU, self.OnCloseMe, menuItem)
     menu2 = wx.Menu()
     # 创建菜单项MenuItem
     menu2.Append(wx.NewId(), '&Copy', 'Copy in status bar')
     menu2.Append(wx.NewId(), '&Cut', '')
     menu2.Append(wx.NewId(), '&Paste', '')
     menu2.AppendSeparator()
     menu2.Append(wx.NewId(), '&Options', 'Display Options')
     menuBar.Append(menu2, '&Edit')  # 在菜单栏上附上菜单
     self.SetMenuBar(menuBar)  # 在Frame上面附加菜单
Example #8
0
 def __init__(self, parent, id):
     wx.Frame.__init__(self, parent, id, '工具栏', size=(500, 200))
     panel = wx.Panel(self)
     panel.SetBackgroundColour('White')
     toolbar = self.CreateToolBar()  #2 创建工具栏
     toolbar.AddSimpleTool(wx.NewId(), images.getPyBitmap(), "New",
                           "Long help for 'New'")  #3 给工具栏增加一个工具
     toolbar.Realize()  # 准备显示工具栏
Example #9
0
 def __init__(self, parent, id):
     wx.Frame.__init__(self, parent, id, '工具栏',
             size=(500, 200))
     panel = wx.Panel(self)
     panel.SetBackgroundColour('White')
     toolbar = self.CreateToolBar()     #2 创建工具栏
     toolbar.AddSimpleTool(wx.NewId(), images.getPyBitmap(),
             "New", "Long help for 'New'") #3 给工具栏增加一个工具
     toolbar.Realize() # 准备显示工具栏
Example #10
0
 def __init__(self, parent, id):
     wx.Frame.__init__(self, parent, id, 'Toolbars', size=(300,200))
     panel = wx.Panel(self)
     panel.SetBackgroundColour('White')
     statusBar = self.CreateStatusBar()#1
     toolbar = self.CreateToolBar()#2
     toolbar.AddSimpleTool(wx.NewId(),images.getPyBitmap(),"New","Long help for 'New'")#3
     toolbar.Realize()#4
     menuBar = wx.MenuBar()
     menu1 = wx.Menu()
     menuBar.Append(menu1,"&File")
     menu2 = wx.Menu()
     #6
     menu2.Append(wx.NewId(),"&Copy","Copy in status bar")
     menu2.Append(wx.NewId(),"C&ut","")
     menu2.Append(wx.NewId(),"Paste","")
     menu2.AppendSeparator()
     menu2.Append(wx.NewId(),"&Options...","Display Options")
     menuBar.Append(menu2,"&Edit")
     self.SetMenuBar(menuBar)
Example #11
0
 def __init__(self, parent, id):
     wx.Frame.__init__(self, parent, id, 'Toolbars', size=(300, 200))
     panel = wx.Panel(self)
     panel.SetBackgroundColour('White')
     statusBar = self.CreateStatusBar()
     toolbar = self.CreateToolBar()
     toolbar.AddTool(wx.NewIdRef(), "New", images.getPyBitmap(),
                     "Long help for 'New'")
     toolbar.Realize()
     menuBar = wx.MenuBar()
     fileMenu = wx.Menu()
     menuBar.Append(fileMenu, "&File")
     editMenu = wx.Menu()
     editMenu.Append(wx.NewIdRef(), "&Copy", "Copy in status bar")
     editMenu.Append(wx.NewIdRef(), "C&ut", "Cut in status bar")
     editMenu.Append(wx.NewIdRef(), "Paste", "Paste in status bar")
     editMenu.AppendSeparator()
     editMenu.Append(wx.NewIdRef(), "&Options...", "Display Options")
     menuBar.Append(editMenu, "&Edit")
     self.SetMenuBar(menuBar)
Example #12
0
	def __init__(self, parent,id):
		wx.Frame.__init__(self, parent, id, 'Toolbars', size=(300,200))
		panel = wx.Panel(self)
		panel.SetBackgroundColour('White')
		statusBar = self.CreateStatusBar()
		toolbar = self.CreateToolBar()
		toolbar.AddSimpleTool(wx.NewId(), images.getPyBitmap(),'New',"Long help for 'New'")
		toolbar.Realize()
		menuBar = wx.MenuBar()
		menu1 = wx.Menu()
		menuBar.Append(menu1, '&File')
		menu1.AppendSeparator() 
		menu2 = wx.Menu()
		menu2.Append(wx.NewId(), "&Copy", 'Copy in status bar')  
		menu2.Append(wx.NewId(), 'C&ut', '')   
		menu2.Append(wx.NewId(), 'Paste', '')                     
		menu2.AppendSeparator()                                   
		menu2.Append(wx.NewId(), '&Options...', 'Display Options')
		menuBar.Append(menu2, '&Edit') # 在菜单栏上附上菜单
		self.SetMenuBar(menuBar)  # 在框架上附上菜单栏
	def __init__(self, parent, id):
		wx.Frame.__init__(self, parent, id, "Toolbars", size=(300, 200))
		panel = wx.Panel(self)
		panel.SetBackgroundColour('White')
		statusBar = self.CreateStatusBar()#创建状态栏
		toolbar = self.CreateToolBar()#创建工具栏
		toolbar.AddSimpleTool(wx.NewId(), images.getPyBitmap(), 'New', 'Long help for New')
		toolbar.Realize()#准备显示工具栏,方法告诉工具栏这些工具按钮应该放置在哪儿
		menuBar = wx.MenuBar()
		#创建两个菜单
		menu1 = wx.Menu()
		menuBar.Append(menu1, '&File')
		menu2 = wx.Menu()
		#创建菜单的项目
		menu2.Append(wx.NewId(), '&Copy', 'Copy in status bar')
		menu2.Append(wx.NewId(), 'C&ut', '')
		menu2.Append(wx.NewId(), 'Paste', '')
		menu2.AppendSeparator()
		menu2.Append(wx.NewId(), '&Options...', 'Display Options')
		menuBar.Append(menu2, '&Edit')#在菜单栏上附上菜单
		self.SetMenuBar(menuBar)
Example #14
0
 def __init__(self, parent, id):
     wx.Frame.__init__(self, parent, id, 'Toolbars', size= (300,200));
     panel = wx.Panel(self);
     panel.SetBackgroundColour('White');
     statusBar = self.CreateStatusBar(); #1创建状态栏
     toolbar = self.CreateToolBar(); #2创建工具栏
     toolbar.AddSimpleTool(wx.NewId(), images.getPyBitmap(), "New", "Long help for 'New'"); #3给工具栏加一个工具
     toolbar.Realize(); #4准备显示工具栏
     menuBar = wx.MenuBar() #创建菜单栏
     #创建两个菜单
     menu1 = wx.Menu();
     menuBar.Append(menu1, "&File");
     menu2 = wx.Menu();
     #6创建菜单项目 
     menu2.Append(wx.NewId(), "&Copy", "Copy in status bar");
     menu2.Append(wx.NewId(), "C&ut", "");
     menu2.Append(wx.NewId(), "Paste", "");
     menu2.AppendSeparator();
     menu2.Append(wx.NewId(), "&Options...", "Display Options");
     menuBar.Append(menu2, "&Edit"); #在菜单栏上附上菜单
     self.SetMenuBar(menuBar) #在框架中附上菜单栏
    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,"Toolbar",size=(300,200))
        panel = wx.Panel(self)
        panel.SetBackgroundColour('White')
        statusBar = self.CreateStatusBar() #1. 创建状态栏
        toolbar = self.CreateToolBar() #2. 创建工具栏
        toolbar.AddSimpleTool(wx.NewId(),images.getPyBitmap(),"New","Long help for 'new' ") #3. 给工具栏增加一个工具

        toolbar.Realize() #4 准备显示工具栏
        menuBar = wx.MenuBar() # 创建菜单栏

        menu1 = wx.Menu() #创建两个菜单
        menuBar.Append(menu1,"&File")
        menu2 = wx.Menu()
        #创建菜单的项目
        menu2.Append(wx.NewId(),"Copy","Copy in status bar")
        menu2.Append(wx.NewId(),"Cut","把你剪了哦")
        menu2.Append(wx.NewId(),"Paste","")
        menu2.AppendSeparator()
        menu2.Append(wx.NewId(),"Option...","Display Options")
        menuBar.Append(menu2,"&Edit") #在菜单栏上附上菜单
        self.SetMenuBar(menuBar) #在框架上附上菜单栏
    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, "Toolbar", size=(300, 200))
        panel = wx.Panel(self)
        panel.SetBackgroundColour('White')
        statusBar = self.CreateStatusBar()  #1. 创建状态栏
        toolbar = self.CreateToolBar()  #2. 创建工具栏
        toolbar.AddSimpleTool(wx.NewId(), images.getPyBitmap(), "New",
                              "Long help for 'new' ")  #3. 给工具栏增加一个工具

        toolbar.Realize()  #4 准备显示工具栏
        menuBar = wx.MenuBar()  # 创建菜单栏

        menu1 = wx.Menu()  #创建两个菜单
        menuBar.Append(menu1, "&File")
        menu2 = wx.Menu()
        #创建菜单的项目
        menu2.Append(wx.NewId(), "Copy", "Copy in status bar")
        menu2.Append(wx.NewId(), "Cut", "把你剪了哦")
        menu2.Append(wx.NewId(), "Paste", "")
        menu2.AppendSeparator()
        menu2.Append(wx.NewId(), "Option...", "Display Options")
        menuBar.Append(menu2, "&Edit")  #在菜单栏上附上菜单
        self.SetMenuBar(menuBar)  #在框架上附上菜单栏
Example #17
0
    def __init__(self, parent, nid):
        super(ToolBarFrame, self).__init__(parent,
                                           id=nid,
                                           title="ToolBars",
                                           size=(300, 200))
        panel = wx.Panel(self)
        panel.SetBackgroundColour("White")
        # 1 创建状态栏  出现了状态栏--虽然没有显式调用 这行创建了一个状态栏,它是类wx.StatusBar的实例。它被放置在框架
        # 的底部,宽度与框架相同,高度由操作系统决定。状态栏的目的是显示在应用
        # 程序中被各种事件所设置的文本。
        status_bars = self.CreateStatusBar()

        # 2 创建工具栏创建了一个wx.ToolBar的实例, 它是命令按钮的容器。它被自动放置在框架的顶部
        toolbar = self.CreateToolBar()
        # 3 给工具栏增加一个工具
        toolbar.AddTool(wx.NewIdRef(),
                        "NEW",
                        images.getPyBitmap(),
                        wx.NullBitmap,
                        shortHelp="new",
                        longHelp="Long Help for new")
        toolbar.Realize()  # 4 准备显示工具栏

        # 创建菜单的项目, 其中参数分别代表ID, 选项的文本, 当鼠标位于其上时显示在状态栏的文本。
        menu_bar = wx.MenuBar()  # 创建菜单栏
        # 创建两个菜单
        menu1 = wx.Menu()
        menu_bar.Append(menu1, "File")

        menu2 = wx.Menu()
        menu2.Append(wx.NewIdRef(), "COPY", "Copy in status bar")
        menu2.Append(wx.NewIdRef(), "Cut", "")
        menu2.Append(wx.NewIdRef(), "Paste", "")
        menu2.AppendSeparator()
        menu2.Append(wx.NewIdRef(), "Options...", "Display Options")
        menu_bar.Append(menu2, "Edit")  # 在菜单栏上附上菜单
        self.SetMenuBar(menu_bar)  # 在框架上附上菜单栏