wxPython:绘画按钮BitmapButton介绍
2012-07-20 22:33
381 查看
本节看一个绘图按钮的使用,先看看代码:
测试:
![](http://pic002.cnblogs.com/images/2012/323652/2012072022312530.png)
知识点介绍:
原型:
wxBitmapButton( wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW, const wxValidator& validator = wxDefaultValidator, const wxString& name = "button")
方法:
wxBitmapButton::Create
wxBitmapButton::GetBitmapDisabled
wxBitmapButton::GetBitmapFocus
wxBitmapButton::GetBitmapHover
wxBitmapButton::GetBitmapLabel
wxBitmapButton::GetBitmapSelected
wxBitmapButton::SetBitmapDisabled
wxBitmapButton::SetBitmapFocus
wxBitmapButton::SetBitmapHover
wxBitmapButton::SetBitmapLabel
wxBitmapButton::SetBitmapSelected
#!/usr/bin/env python # -*- coding: utf-8 -*- import wx ''' Function:绘图 Input:NONE Output: NONE author: socrates blog:http://www.cnblogs.com/dyx1024/ date:2012-07-20 ''' class BitmapButtonFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, "Bitmap button example", size = (600, 400)) panel = wx.Panel(self, -1) panel.SetBackgroundColour("blue") #创建一个绘图对象 bmp = wx.Image("test2.bmp", wx.BITMAP_TYPE_BMP).ConvertToBitmap() #绘图按钮1,默认风格3D self.button = wx.BitmapButton(panel, -1, bmp, pos = (50, 20)) self.Bind(wx.EVT_BUTTON, self.OnClick, self.button) self.button.SetDefault() #绘图按钮1,不带边框 self.button2 = wx.BitmapButton(panel, -1, bmp, style = 0, pos = (350, 20)) self.Bind(wx.EVT_BUTTON, self.OnClick, self.button) self.button.SetDefault() def OnClick(self, event): self.Destroy() if __name__ == '__main__': app = wx.PySimpleApp() frame = BitmapButtonFrame() frame.Show() app.MainLoop()
测试:
![](http://pic002.cnblogs.com/images/2012/323652/2012072022312530.png)
知识点介绍:
原型:
wxBitmapButton( wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW, const wxValidator& validator = wxDefaultValidator, const wxString& name = "button")
方法:
wxBitmapButton::Create
wxBitmapButton::GetBitmapDisabled
wxBitmapButton::GetBitmapFocus
wxBitmapButton::GetBitmapHover
wxBitmapButton::GetBitmapLabel
wxBitmapButton::GetBitmapSelected
wxBitmapButton::SetBitmapDisabled
wxBitmapButton::SetBitmapFocus
wxBitmapButton::SetBitmapHover
wxBitmapButton::SetBitmapLabel
wxBitmapButton::SetBitmapSelected
相关文章推荐
- wxPython:绘画按钮BitmapButton介绍
- 图形按钮BitmapButton的实现
- extjs的Ext.button.Button介绍(按钮的事件有哪些)。
- 图标按钮、位图按钮、CBitmapButton 类位图按钮的制作
- Android 5.0新控件 FloatingActionButton | 悬浮按钮 介绍及使用详情
- wxPython常用控件--wx.Font,wx.StaticText,wx.StaticBitmap,wx.Button,wx.TextCtrl
- Cocos2d-x_CCControlButton(按钮类)介绍
- 2011-3 使用BitmapButton实现按钮加载图标
- 图像状态资源的介绍~~以button按钮为例
- 按钮(Button)介绍与应用
- Button 按钮的点击时候出现蓝色边框
- Android Button按钮两个页面切换 分类: Android开发 2014-05-30 10:54 60人阅读 评论(0) 收藏
- android 客户端学习-给button按钮设置圆角
- jquery实现button按钮的点击事件
- Vuforia Virtual Button(虚拟按钮)案例一——按钮位置计算
- wxpython 按钮等事件的触发
- ToggleButton(开关按钮)和Switch(开关)的使用
- 3.Textview和Button的使用:点击按钮,返回点击次数
- asp 验证控件导致 button按钮 事件无效
- wxpython 编程触发菜单或按钮事件