文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Core Windows/Controls → BitmapButton

Core Windows/Controls → BitmapButton

时间:2007-04-12  来源:wxPhoenix

Overview = """\ A BitmapButton control displays a bitmap. It can have a separate bitmap for each button state: normal, selected, disabled. The bitmaps to be displayed should have a small number of colours, such as 16,
to avoid palette problems.
A bitmap can be derived from most image formats using the wx.Image class. """
import wx

class Frame(wx.Frame):
 def __init__(self, parent, id=-1, title='BitmapButton', pos=wx.DefaultPosition,
  size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE
  ):
  
  wx.Frame.__init__(self, parent, id, title, pos, size, style)
  
  Panel = wx.Panel(self, -1)
  Bitmap = wx.Bitmap('SPALDING.jpg', type=wx.BITMAP_TYPE_ANY)
  Button = wx.BitmapButton(Panel, -1, Bitmap, (20, 20), (Bitmap.GetWidth()+10, Bitmap.GetHeight()+10))
  # Additional number of 10 brings BitmapButton 3D look!
  Button.SetToolTipString('This is a bitmap button.')
  self.Bind(wx.EVT_BUTTON, self.OnTest, Button)
  
  Button = wx.BitmapButton(Panel, -1, Bitmap, (20, 300), style=wx.NO_BORDER)
  Button.SetToolTipString('This is a bitmap button with wx.NO_BORDER')
  self.Bind(wx.EVT_BUTTON, self.OnTest, Button)
  
  
 def OnTest(self, event):
  wx.MessageBox('You have clicked wx.BitmapButton.', 'Prompt')
  
  
  
def TestFrame():
 app = wx.PySimpleApp()
 frame = Frame(parent=None)
 frame.Centre()
 frame.Show()
 app.MainLoop()
 
if __name__ == '__main__':
 TestFrame()
相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载