wxPython: StaticText Event

John McMonagle jmcmonagle at velseis.com.au
Thu Sep 7 20:24:52 EDT 2006


> 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?
> 

According to the book "wxPython In Action", page 186:

"One feature that you cannot see from just the figure is that the
wx.StaticText window never receives or responds to mouse events, and
never takes the user focus."



If you want to create static text that responds to mouse events, try
using the wx.lib.stattext.GenStaticText class.  

Add the following import:

import wx.lib.stattext

Then,

self.st = wx.lib.stattext.GenStaticText(self.pnl, -1, 'Static Text
Control', pos=(30,20))

Regards,

John



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Python-list mailing list