Event processing and layering

Hello,

      Is there any easy way to build layered application?
      Like to plase buttons above bitmap...
      For example i want place StaticText on the top of the
      HTMLWindow, but without StaticText background.(i have tried
      style=wx.TRANSPARENT it is not working, setbackgroundcolor seems
      to be waiting for wxColour instance)
      And also i want it always to stay on top of the htmlwindow.
      (when i try to select text in htmlwindow, it seems it recieves
      some king if focus and static text goes behind htmlwindow)

      Also would be great to see an example of making transparent
      top frame (i have made a simple (like self.Bind(wx.EVT_ERASE_BACKGROUND, lambda evt: None)
      ) but when i move it - the background do not changes, it only
      changes when window is maximized).

      Where i can find documentation on wx.EVT_* ??
      There is a whole bunch of them, but no docs of when do they
      happen and in what order.

      Also is there any simple way to see pending events?

      I have Noel Rappin "wxPython in Action" read first few chapters.
      Hmm.. creating my own Event (TwoButtonClick in book) seemed to
      me some kind odd and strange. I wasnt able to rearrage it creaty
      my event to ERASE_BACKGROUND by hand. For example tried to
      process ERASE_BACKGROUND in OnMove handler:

      self.Bind(wx.EVT_MOVE,self.OnMove)
      ...

      def OnMove(self,evt):
          self.GetEventHandler().ProcessEvent(wx.EVT_ERASE_BACKGROUND)

      this gives me an error:
      TypeError: argument number 2: a 'wxEvent *' is expected,
      'PyEventBinder(<wx._core.PyEventBinder object at 0x012CE330>)' is received

      Huh.. any good articles on layering and event
      processing/creation?

···

--
Best regards,
Norman mailto:NormanTindall@zdisk.net

Norman Tindall wrote:

Hello,

      Is there any easy way to build layered application?
      Like to plase buttons above bitmap...
      For example i want place StaticText on the top of the
      HTMLWindow, but without StaticText background.(i have tried
      style=wx.TRANSPARENT it is not working, setbackgroundcolor seems
      to be waiting for wxColour instance)
      And also i want it always to stay on top of the htmlwindow.
      (when i try to select text in htmlwindow, it seems it recieves
      some king if focus and static text goes behind htmlwindow)

Is the static text a child of the html window or a sibling? (wx doesn't have well defined behavior for overlapping siblings.) If that's not the problem then it could just be how the html window is repainting itself and it's not expecting to have a child window there, and since it is a static it just paints over that location.

      Also would be great to see an example of making transparent
      top frame (i have made a simple (like self.Bind(wx.EVT_ERASE_BACKGROUND, lambda evt: None)
      ) but when i move it - the background do not changes, it only
      changes when window is maximized).

When you provide an empty handler for EVT_ERASE_BACKGROUND like that it doesn't remove the background of the window so the things below shine through, it instead just does nothing when asked to paint the background. So when you move the frame it still moves what is currently the background, and then doesn't paint it again.

What you are probably looking for is a shaped frame. Take a look in the demo for an example of making portions of a frame truly transparent.

      Where i can find documentation on wx.EVT_* ??
      There is a whole bunch of them, but no docs of when do they
      happen and in what order.

They are mostly documented either with the window class that they are associated with, or with the event class that is sent when the event happens.

When and order is somewhat dependent on platform, and in some cases even on the version of the platform.

      Also is there any simple way to see pending events?

No, there is no platform independent way to peek ahead.

      I have Noel Rappin "wxPython in Action" read first few chapters.
      Hmm.. creating my own Event (TwoButtonClick in book) seemed to
      me some kind odd and strange. I wasnt able to rearrage it creaty
      my event to ERASE_BACKGROUND by hand. For example tried to
      process ERASE_BACKGROUND in OnMove handler:

      self.Bind(wx.EVT_MOVE,self.OnMove)
      ...

      def OnMove(self,evt):
          self.GetEventHandler().ProcessEvent(wx.EVT_ERASE_BACKGROUND)

      this gives me an error:
      TypeError: argument number 2: a 'wxEvent *' is expected,
      'PyEventBinder(<wx._core.PyEventBinder object at 0x012CE330>)' is received

wx.EVT_ERASE_BACKGROUND is the object used for making a binding between an event type and the handler that should be called. If you want to send an event yourself then you need to make an instance of a wx.Event class, in this case it would be wx.EraseBackgroundEvent.

            Huh.. any good articles on layering

and event
      processing/creation?

There are some samples in the demo and in the wiki.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!