wx statusbar
时间:2010-04-13 来源:masonzhang
For statusbar how to using wxPython's API
#-*- coding:cp936 -*-
import wx
class From(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self,parent,id,title)
self.count = 0
self.stringlist = ['A','B','C','D']
self.StatusBar = wx.StatusBar(self,-1)
self.StatusBar.SetFieldsCount(4)
self.StatusBar.SetStatusWidths([-4,-2,-2,-2])
self.StatusBar.SetStatusText('fieldA',0)
self.StatusBar.SetStatusText('fieldB',1)
self.StatusBar.SetStatusText('fieldC',2)
self.StatusBar.SetStatusText('fieldD',3)
menubar = wx.MenuBar()
popmenu = wx.Menu()
popmenu.Append(100,'PUSH')
popmenu.Append(101,'POP')
menubar.Append(popmenu,'菜单选择')
self.SetMenuBar(menubar)
#事件绑定
wx.EVT_MENU(self,100,self.click_push)
wx.EVT_MENU(self,101,self.click_pop)
self.Center()
self.SetMinSize((320,480))
self.SetMaxSize((640,480))
def click_push (self,event):
self.StatusBar.PushStatusText(self.stringlist[self.count],0)
self.count +=1;
self.count %=4;
def click_pop(self,event):
clip = wx.TextDataObject()
if wx.TheClipboard.Open():
success = wx.TheClipboard.GetData(clip)
wx.TheClipboard.Close()
if success:
wx.MessageBox(clip.GetText())
app = wx.PySimpleApp()
From(None,-1,'D9.py').Show()
app.MainLoop()
相关阅读 更多 +