Re: [wxPython-users] Doubt with event handling: can I event.Skip() all the time?
by Peter Damoc other posts by this author
Jul 23 2004 6:11AM messages near this date
[wxPython-users] Re: Doubt with event handling: can I event.Skip() all the time?
|
[wxPython-users] Re: Doubt with event handling: can I event.Skip() all the time?
On Thu, 22 Jul 2004 14:52:18 -0300, Jorge Godoy <godoy@[...].org> wrote:
> Hi!
>
> Could there be any problem if I adopt a default of ending my methods
> with an 'event.Skip()' call for each and every method that is activated
> by an event?
placing an event.Skip() at the end will call the default handlers, they
get called anyway if you don't handle the event so... there shouldn't be a
problem... unless... handling the event means sinking it, preventing it
from reaching those default handlers...
take a look at this:
import wx
class TestApp(wx.App):
def OnInit(self):
frame = wx.Frame(None, -1, "Test Evt.Skip()")
frame.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)
frame.Show()
return True
def OnErase(self, evt):
dc = evt.GetDC()
dc.DrawRectangle(0,0,50,50)
evt.Skip()
TestApp(0).MainLoop()
run the app see what happens
now comment the evt.Skip() line and run the app again.
With evt.Skip() enabled you don't get to see the rectangle BUT the
background of the frame is drawn corectly
With evt.Skip() commented you see the rectangle but the background is not
drawn rigth anymore (try resizing to see what I mean)
--
Peter Damoc
Hacker Wannabe
http://www.sigmacore.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@[...].org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Thread:
Jorge Godoy
Eugene Borodkin
Eugene Borodkin
Eugene Borodkin
Mikael Norgren
Jorge Godoy
Peter Damoc
Jorge Godoy
Robin Dunn
|