Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 软件时空 > 软件相关 > 在wxPython中应用双缓冲(double buffering)
【标  题】:在wxPython中应用双缓冲(double buffering)
【关键字】:wxPython,double,buffering
【来  源】:http://blog.csdn.net/zhuoqiang/archive/2006/05/25/755423.aspx

在wxPython中应用双缓冲(double buffering)

Your Ad Here class Canvas(wx.Window):
    def __init__(self, parent, id=wx.ID_ANY, colour=wx.WHITE,
                 pos=wx.DefaultPosition, size=None,
                 style=wx.NO_FULL_REPAINT_ON_RESIZE,
                 name='qiang.canvas'):
        wx.Window.__init__(self, parent, id, pos, size, style, name)
        if not size:
            size = wx.ScreenDC().GetSize()
        self._buffer = wx.EmptyBitmap(size[0], size[1])
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        self.Bind(wx.EVT_PAINT, self.__OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.SetBackgroundColour(colour)
        self.ClearBackground()
       

    def ClearBackground(self):
        dc = self.GetDC()
        dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
        dc.Clear()


    def GetDC(self):
        return wx.BufferedDC(wx.ClientDC(self), self._buffer)


    def Enlarge(self, size):
        newWidth, newHeight = size
        width, height = self._buffer.GetSize()
        needEnlarge = False
        if newWidth > width:
            width, needEnlarge = newWidth, True
        if newHeight > height:
            height, newHeight = newHeight, True
        if needEnlarge:
            self._buffer = wx.EmptyBitmap(width, height)
            self.ClearBackground()

   
    def __OnPaint(self, event):
        wx.BufferedPaintDC(self, self._buffer)


    def OnSize(self, event):
        self.Enlarge(self.GetSize())
修改了一下StringLayout,增加了翻页功能,并且还有了滚动条,希望多多提意见.:【上一篇】
发给网易邮件客服的信,关于新的退信格式问题:【下一篇】
【相关文章】
  • 如何以正确的格式输出Double浮点数
  • double类型赋值问题
  • 怎样的获取double 的精度数据,求精度数据
  • Double Dispatch And Visitor Pattern
  • 9GB的诱惑:DVD Double Layer技术浅析
  • python上面的图形开发wxPython
  • 做Double NAT的一种可行方法
  • 怎么写wxPython更pythonic?
  • 1.*把long转换为double
  • The Double NAT MINI-HOWTO
  • 【随机文章】
  • TMC综合症
  • PHP+DBM的同学录程序(1)
  • 国家农业标准化示范区管理系统验收通过
  • inux内核学习网站搜集(欢迎补充)
  • 顺序容器及相应的容器适配器
  • C++ Binary File I/O
  • [bingo] Linux grep 使用
  • 地热
  • 玄奘之路 心灵里程的回顾
  • Cisco的小型企业解决方案
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.