0

首先,调试器不会触及我的断点。它在我的自定义类的 OnPaint 方法的第一条指令中设置。

import wx.aui, wx.lib.agw.aui
from wx.lib import platebtn
import wx.lib.scrolledpanel as spanel
class GuiScrolledPanel(spanel.ScrolledPanel):
    def __init__(self, *args, **kwargs):
        spanel.ScrolledPanel.__init__(self, *args, **kwargs)
        self.SetSizer(GuiSchemaSizer())   
        self.SetupScrolling()         
        self.caption = "No active schema - Create a new schema or load one "

    def OnChildFocus(self, *args, **kwargs):
        self.Layout()
        self.AdjustScrollbars()
        return spanel.ScrolledPanel.OnChildFocus(self, *args, **kwargs)

    def updateCaption(self, caption):
        self.caption = caption

    def OnPaint(self, *args, **kwargs):
        some_result = spanel.ScrolledPanel.OnPaint(self, *args, **kwargs)
        print  'OnPaint in MyDrawingArea'
        dc = wx.PaintDC(self)

        dc.BeginDrawing()
        if self.BufferBmp != None:
            print  '...drawing'
            dc.DrawBitmap(self.BufferBmp, 0, 0, True)
            #should draw smth here, but what's the point when the method isn't even called, heh?
        else:
            print  '...nothing to draw'
        dc.EndDrawing()
        return some_result 

多谢 :)

4

1 回答 1

0

看来 OnPaint 方法必须在事件中注册wx.EVT_BIND

    self.Bind(wx.EVT_PAINT, self.OnPaint)
于 2013-06-24T08:14:40.673 回答