資源簡(jiǎn)介
lab04.zip

代碼片段和文件信息
#?_*_coding:utf-8_*_
import?wx
import?os
os.chdir(‘C:\Users\FXJ\Desktop‘?+?u‘\課程\多平臺(tái)應(yīng)用開發(fā)\作業(yè)‘?+?‘\wxPython\lab04‘)
class?Myframe(wx.frame):
????def?__init__(self):
????????wx.frame.__init__(self?None?-1?u“第4次上機(jī)作業(yè)(WX)“?size=(800?500))
????????self.panel?=?wx.Panel(self)
????????self.icon1?=?wx.Icon(name=“icon1.ico“??type=wx.BITMAP_TYPE_ICO)
????????self.icon2?=?wx.Icon(name=“icon2.ico“?type=wx.BITMAP_TYPE_ICO)
????????self.icon3?=?wx.Icon(name=“icon3.ico“?type=wx.BITMAP_TYPE_ICO)
????????self.SetIcon(self.icon1)
????????self.word?=?wx.StaticText(self.panel?-1?u““?pos=(200?100))
????????self.word.SetLabel(u“當(dāng)前使用的圖標(biāo)是:圖標(biāo)1“)
????????self.word.SetFont(wx.Font(15?wx.SWISS?wx.NORMAL?wx.BOLD?False))
????????#?Create?the?MenuBar
????????self.menuBar?=?wx.MenuBar()
????????#?and?a?menu
????????menu?=?wx.Menu()
????????menu.Append(wx.ID_EXIT?u“E&xit\tCtrl+Shift+Delete“?u“Exit?this?simple?sample“)
????????#?bind?the?menu?event?to?an?event?handler
????????self.Bind(wx.EVT_MENU?self.OnClose?id=wx.ID_EXIT)
????????#?and?put?the?menu?on?the?MenuBar
????????self.menuBar.Append(menu?u“&File“)
????????#?add?a?icon?menu
????????self.icon?=?wx.Menu()
????????self.icon.Append(201?u“圖標(biāo)1\tCtrl+1“?u““?wx.ITEM_RADIO)
????????self.icon.Append(202?u“圖標(biāo)2\tCtrl+2“?u““?wx.ITEM_RADIO)
????????self.icon.Append(203?u“圖標(biāo)3\tCtrl+3“?u““?wx.ITEM_RADIO)
????????self.iSelectIcon?=?201
????????self.Bind(wx.EVT_MENU_RANGE?self.OnIcon?id=201?id2=203)
????????self.menuBar.Append(self.iconu“圖標(biāo)(&I)“)
????????self.menuBar.Check(self.iSelectIconTrue)
????????self.SetBackgroundColour(u“Gray“)
????????self.show?=?wx.Menu()
????????self.show.Append(301?u“顯示1\tCtrl+Shift+1“?u““?wx.ITEM_CHECK)
????????self.show.Append(302?u“顯示2\tCtrl+Shift+2“?u““?wx.ITEM_CHECK)
????????self.show.Append(303?u“顯示3\tCtrl+Shift+3“?u““?wx.ITEM_CHECK)
????????self.show.Append(304?u“顯示4\tCtrl+Shift+4“?u““?wx.ITEM_CHECK)
????????#?建立空列表s,在s里面添加4個(gè)wx.StaticText用來顯示文字
????????self.s=?[]
????????self.s.append(wx.StaticText(self.panel?-1?u““?pos=(300?200)))
????????self.s.append(wx.StaticText(self.panel?-1?u““?pos=(400?200)))
????????self.s.append(wx.StaticText(self.panel?-1?u““?pos=(300?250)))
????????self.s.append(wx.StaticText(self.panel?-1?u““?pos=(400?250)))
????????self.menuBar.Append(self.showu“顯示(&D)“)
????????self.Bind(wx.EVT_MENU?self.OnShow?id=301?id2=304)
????????self.iSelectShow?=?[False?False?False?False]
????????#?add?another?menu
????????menu?=?wx.Menu()
????????IdAbout?=?menu.Append(-1?u“程序信息(&I)\tF1“?u“Help?tip“)
????????self.Bind(wx.EVT_MENU?self.onhelp?IdAbout)
????????#?and?put?the?menu?on?the?menubar
????????self.menuBar.Append(menu?u“關(guān)于(&A)“)
????????self.SetMenuBar(self.menuBar)
????????self.CreateStatusBar()
????????self.Bind(wx.EVT_PAINT?self.OnPaint)
????def?OnIcon(self?evt):
????????item?=?evt.GetId()
????????#?word?=wx.StaticText(
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-04-29?11:19??lab04\
?????文件????????1078??2017-03-17?01:23??lab04\icon1.ico
?????文件????????3638??2017-03-17?08:33??lab04\icon2.ico
?????文件????????3638??2017-03-17?08:33??lab04\icon3.ico
?????文件????????4933??2017-06-09?20:45??lab04\lab04.py
評(píng)論
共有 條評(píng)論