wx.ClientDC zetcode explanation

Hi, I am on a MacBook, 10.6.3, running the following:

import wx

class Line(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(250, 150))
        
        wx.FutureCall(2000, self.DrawLine)
        
        self.Centre()
        self.Show()
        
    def DrawLine(self):
        dc = wx.ClientDC(self)
        dc.DrawLine(50, 60, 190, 60)
        
app = wx.App(False)
Line(None, -1, 'Line')
app.MainLoop()
        
The zetcode tutorial on http://www.zetcode.com/wxpython/gdi/ says the following: "It is very important to understand the following behaviour. If we resize the window, the line will disappear. Why is this happening?"

Well, on my system, the line doesn't disappear when I resize the window. Can someone explain?

D.

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

David Arnold wrote:

Hi, I am on a MacBook, 10.6.3, running the following:

import wx

class Line(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(250, 150))
                wx.FutureCall(2000, self.DrawLine)
                self.Centre()
        self.Show()
            def DrawLine(self):
        dc = wx.ClientDC(self)
        dc.DrawLine(50, 60, 190, 60)
        app = wx.App(False)
Line(None, -1, 'Line')
app.MainLoop()
        The zetcode tutorial on http://www.zetcode.com/wxpython/gdi/ says the following: "It is very important to understand the following behaviour. If we resize the window, the line will disappear. Why is this happening?"

this is expected because yuo haven't provided a Paint handler to update the screen when the system asks for it to be refreshed.

Well, on my system, the line doesn't disappear when I resize the window. Can someone explain?

OS-X double buffers for you, so it may not be asking for a refresh when you resize , but it certainly will under some circumstances, and they you won't have the line any more.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en