WxPython is a good module in python visual programming. The following code mainly describes the implementation of toolbar, status bar, menu, menu events (refer to: http://www.czug.org/python/wxpythoninaction ):
#! /Usr/bin/env python #-*-coding: UTF-8-*-import wximport wx. py. imagesclass ToolbarFrame (wx. frame): def _ init _ (self, parent, id): wx. frame. _ init _ (self, parent, id, 'toolbars', size = (600,400) panel = wx. panel (self) panel. setBackgroundColour ('white') # create the status bar statusBar = self. createStatusBar () # create toolbar = self. createmedilbar () # Add a tool toolbar. addSimpleTool (wx. newId (), wx. py. images. getPyBitmap (), "New", "Long help for 'new'") toolbar. addSimpleTool (wx. newId (), wx. py. images. getPyBitmap (), "Edit", "Long help for 'edit'") # Prepare to display the toolbar. realize () # create menu menuBar = wx. menuBar () menu1 = wx. menu () menuBar. append (menu1, u "& file") # menu item 1 self. close = menu1.Append (wx. newId (), u "exit (& X)", "") menu2 = wx. menu () # Menu content & indicates that subsequent characters are hotkeys, and parameter 3 indicates the Menu item description self displayed on the status bar. copy = menu2.Append (wx. newId (), "& Copy", "Copy in status bar") self. cut = menu2.Append (wx. newId (), "C & ut", "") self. paste = menu2.Append (wx. newId (), "Paste", "") menu2.AppendSeparator () self. options = menu2.Append (wx. newId (), "& Options... "," Display Options ") self. edit = menuBar. append (menu2, "& Edit") self. setMenuBar (menuBar) # Call the menu drop-down exit event self. bind (wx. EVT_MENU, self. onClose, self. close) def OnClose (self, event): # exit the event self. close () if _ name _ = '_ main _': app = wx. pySimpleApp () frame = ToolbarFrame (parent = None, id =-1) frame. show () app. mainLoop ()