This is probably a wxpython question but I am hoping someone here will
see my mistake.
The frame code below kind of works except that when I resize or scroll,
the whole window is not properly redrawn, bits of previous rectangles
are left after painting.
Any tips would be most welcome.
] = [wx.NewId() for _init_ctrls in range(2)]
def _init_ctrls(self, prnt):
# generated method, don't edit
wx.Frame.__init__(self, id=wxID_PREVIEWFRAME, name=u'previewFrame',
parent=prnt, pos=wx.Point(379, 301), size=wx.Size(400, 250),
name='scrolledWindow1', parent=self, pos=wx.Point(0, 0),
size=wx.Size(392, 223), style=wx.HSCROLL | wx.VSCROLL)
def __init__(self, parent):
self.scrolledWindow1.SetScrollbars(20, 20, 20, 20)
def OnScrolledWindow1Paint(self, event):
dc = wx.PaintDC(self.scrolledWindow1)
def DoDraw(self, dc):
dc.DrawRectangle(5, 5, 20, 20)
dc.DrawRectangle(100, 100, 200, 200)
> This is probably a wxpython question but I am hoping someone here will
> see my mistake.
You have to draw with the offset of the scrolled position.
(If you add a Refresh() to the scroll event you'll see that the
drawing is not actually scrolled)
Thanks - will sort that out.
Riaan Booysen wrote:
> Hi Paul,
> sosman wrote:
>> This is probably a wxpython question but I am hoping someone here will
>> see my mistake.
> You have to draw with the offset of the scrolled position.
> (If you add a Refresh() to the scroll event you'll see that the
> drawing is not actually scrolled)