wxFrame.__init__(self, parent, wxID_ANY, title, size = (200, 200),
style = wxDEFAULT_FRAME_STYLE | wxFULL_REPAINT_ON_RESIZE )
···
On Wed, 11 Aug 2004 14:43:23 +0100, Richard Chamberlain <richard.chamberlain@gmail.com> wrote:
Hello,
I'm a wxNewbie so I may be missing something entirely trivial and
obvious to everyone except me.I'm experimenting with drawing and cannot get the following code to do
what it's supposed to do (or at least what I think it is supposed to
do):from wxPython.wx import *
import randomclass MainWindow(wxFrame):
def __init__(self, parent, id, title):
wxFrame.__init__(self, parent, wxID_ANY, title, size = (200, 200))
EVT_PAINT(self, self.OnPaint)
random.seed()
self.Show(True)def OnPaint(self, event):
size = self.GetClientSize()
self.SetTitle("%d, %d" % (size.width, size.height))
dc = wxPaintDC(self)
dc.BeginDrawing()
dc.SetBrush(wxBrush(wxColour(random.randrange(0, 255),
random.randrange(0, 255),
random.randrange(0, 255))))
dc.DrawRectangle(0, 0, size.width, size.height)
dc.EndDrawing()app = wxPySimpleApp()
frame = MainWindow(None, -1, "Graphics")
app.MainLoop()My theory is that when resizing the frame will be entirely filled with
a block colour, but what actually happens is that only the regions
that need painted get the new colour. I've also tried .Clear() to no
avail.The size reports back as expected, i.e. the full width and height of the window.
This is on 2.5.1 on both OS X and XP.
Thanks for any suggestions.
Cheers,
Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org