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 4 4854
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.
Il Fri, 08 Sep 2006 10:24:52 +1000, John McMonagle ha scritto:
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))
Thankyou very much!
Best regards,
David This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: mdk.R |
last post by:
Hello all:
i'am installed wxPython 2.5 and Python2.3.4..i try execute script
with wxPython but it show error:
Traceback (most recent call last):
File "E:\py\test.py", line 7, in ?
import wx...
|
by: KvS |
last post by:
Hi all,
I'm pretty new to (wx)Python so plz. don't shoot me if I've missed
something obvious ;). I have a panel inside a frame, on which a Button
and a StaticText is placed:
self.panel =...
|
by: PeterG |
last post by:
Hi,
I am relatively new to Python, and am learning it as part of a
university
module...
Im currently undertaking a project to create an IM server and IM gui
client.
I have a very basic...
|
by: John Salerno |
last post by:
I'm using the sample code of the file 'simple.py' and trying to make a
single window with a panel in it, but I keep getting an error. Here's my
code: (I know I might need something else, like a...
|
by: John Salerno |
last post by:
I'd be curious to know if this works any differently on other
computers/platforms or while other things are happening in the
background. I can't tell if it's the Timer object that isn't keep...
|
by: zxo102 |
last post by:
Hi everyone,
I am using a python socket server to collect data from a socket
client and then control a image location ( wxpython) with the data,
i.e. moving the image around in the wxpython frame....
|
by: kath |
last post by:
Hello, sorry about the lengthy message.
I finding difficult to execute this program. The wx.Notebook i created
is coming on the splitted frame(self.p2). How do I that. I am started
to learn...
|
by: Tyler |
last post by:
Hello All:
I am currently working on a project to create an FEM model for school.
I was thinking about using wxPython to gather the 12 input variables
from the user, then, after pressing the...
|
by: Gandalf |
last post by:
I try to reach a specific wx StaticText element's text and to change
it by clicking on a button
now let's say the this is my element:
wx.StaticText(panel, 15, "Hello" ,(30, 70) ,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |