wxPython: StaticText Event

David 71david at libero.it
Thu Sep 7 20:01:23 EDT 2006


Plaese look at this simple class.

import wx


class MyFrame(wx.Frame):
      def __init__(self, parent, id):
          wx.Frame.__init__(self, parent, id, "Hide test", size=(160,160))
          
          # create widgets
          self.pnl = wx.Panel(self)
          self.st = wx.StaticText(self.pnl, -1,
                    "Static Text Control", pos=(30,20))
          self.tc = wx.TextCtrl(self.pnl, -1, pos=(30,100))
          self.Layout()
          
          # Binding
          self.st.Bind(wx.EVT_ENTER_WINDOW, self.OnEnterStArea)
          self.tc.Bind(wx.EVT_ENTER_WINDOW, self.OnEnterTcArea)
          
      def OnEnterStArea(self, event):
          print "Mouse entering in STATIC text control area"
          
      def OnEnterTcArea(self, event):
          print "Mouse entering in text control area"
      
app = wx.PySimpleApp()
frame = MyFrame(None, -1)
frame.Show()
app.MainLoop()


Hovering mouse over the StaticText Control should generate an
EVT_ENTER_WINDOW event like the TextCtrl Control, but it does not happen.

How can I make the StaticText event working?

thank you
David



More information about the Python-list mailing list