From 66a1929a956836a012891a486fe3f95c35e90df6 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 1 Apr 2003 01:40:21 +0000 Subject: [PATCH] Updated ShapedWindow demo, don't try to start out without the shape. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/demo/ShapedWindow.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/wxPython/demo/ShapedWindow.py b/wxPython/demo/ShapedWindow.py index 99fab8e5e0..de364e638e 100644 --- a/wxPython/demo/ShapedWindow.py +++ b/wxPython/demo/ShapedWindow.py @@ -16,17 +16,22 @@ class TestFrame(wxFrame): EVT_MOTION(self, self.OnMouseMove) EVT_RIGHT_UP(self, self.OnExit) EVT_PAINT(self, self.OnPaint) - EVT_SIZE(self, self.OnSize) self.bmp = images.getTuxBitmap() w, h = self.bmp.GetWidth(), self.bmp.GetHeight() - #self.SetClientSize( (w, h) ) - self.SetToolTipString("Right-click to close the window") - s = wxStaticText(self, -1, "Double-click the image to set the window shape", - pos = (w+10, h)) - s.SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD)) - s.SetSize(s.GetBestSize()) - self.Fit() + self.SetClientSize( (w, h) ) + self.SetToolTipString("Right-click to close the window\n" + "Double-click the image to set/unset the window shape") + + if wxPlatform == "__WXGTK__": + # wxGTK requires that the window be created before you can + # set its shape, so delay the call to SetWindowShape until + # this event. + EVT_WINDOW_CREATE(self, self.SetWindowShape) + else: + # On wxMSW the window has already been created, so go for it. + self.SetWindowShape() + def SetWindowShape(self, *evt): @@ -46,9 +51,6 @@ class TestFrame(wxFrame): dc = wxPaintDC(self) dc.DrawBitmap(self.bmp, 0,0, True) - def OnSize(self, evt): - pass - def OnExit(self, evt): self.Close()