#!/usr/bin/env python

import wx

class DoubleEventFrame(wx.Frame):

    def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id, 'Frame With Button',
size=(300, 100))
self.panel = wx.Panel(self, -1)
self.cc = 1
self.button = wx.Button(self.panel, -1, "Click Me", pos=(100, 15))
self.Bind(wx.EVT_BUTTON, self.OnButtonClick, self.button)
self.button.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown) def OnButtonClick(self, event):
if self.cc == 1:
self.panel.SetBackgroundColour('Green')
self.cc = 2
else:
self.panel.SetBackgroundColour('RED')
self.cc = 1
self.panel.Refresh() # 这里不管self.Refresh(),只要是parent,或者parent的parent进行Refresh()都可以 def OnMouseDown(self, event):
self.button.SetLabel("Again!")
event.Skip() # 这里,处理完消息以后,还可以继续传递同一条消息继续处理。 if __name__ == '__main__':
app = wx.PySimpleApp()
frame = DoubleEventFrame(parent=None, id=-1)
frame.Show()
app.MainLoop()

最新文章

  1. Serial Port Programming on Linux(转载)
  2. A*算法入门
  3. 初学MFC
  4. SecureCRT访问开发板linux系统
  5. css笔记04:属性选择器
  6. python-MySQLdb-练习
  7. [LeetCode] 032. Longest Valid Parentheses (Hard) (C++)
  8. SVG视野
  9. js 根据身份证号获取性别,年龄,等
  10. float浮动属性的基本常识
  11. O2O淘宝优惠券代码总结
  12. Spring Boot 静态资源路径分析
  13. shell脚本--初识CGI
  14. 一、npm基础
  15. Linux的notifier机制在TP中的应用【转】
  16. [py]js前端求和与flask后端求和
  17. 知识点:Java 内存模型完全解密
  18. 面向对象的css less 和sass
  19. win10系统下我的电脑右键没有属性
  20. C# 获得文件名

热门文章

  1. 10.1综合强化刷题 Day3 morning
  2. Decrease (Judge ver.)
  3. superagent-promise
  4. 2016北京集训测试赛(九)Problem C: 狂飙突进的幻想乡
  5. Android性能优化第(一)篇---基本概念
  6. dedecms图片列表效果调用
  7. const的限定
  8. window脚本命令学习(转)
  9. http://blog.csdn.net/LANGXINLEN/article/details/50421988
  10. ntp时间服务同步