Ok, here's my barebones app example where I'm trying to use a wxClientDC
to draw to a wxScrolledWindow
I get no errors but don't get any drawing either
from wxPython.wx import *
class MyFrame(wxFrame):
def __init__(self, parent, id, title,
pos = wxPyDefaultPosition, size = wxPyDefaultSize,
style = wxDEFAULT_FRAME_STYLE ):
wxFrame.__init__(self, parent, id, title, pos, size, style)
self.bg_bmp = wxBitmap('metal.png', wxBITMAP_TYPE_PNG)
self.sw = wxScrolledWindow(self, -1)
siz = wxBoxSizer(wxVERTICAL)
self.sw.SetSizer(siz)
dc = wxClientDC(self.sw)
dc.SetPen(wxRED_PEN)
self.sw.PrepareDC(dc)
dc.DrawCircle(100, 100,100)
dc.DrawBitmap(self.bg_bmp, 200, 200, False)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):
self.Destroy()
···
#-----------------------------------------------------------------------
-----
class MyApp(wxApp):
def OnInit(self):
wxInitAllImageHandlers()
frame = MyFrame(None, -1, "test", wxPoint(20,20),
wxSize(500,340) )
frame.Show(True)
return True
#-----------------------------------------------------------------------
-----
app = MyApp(True)
app.MainLoop()