[wxPython] I'd like to catch mouse click events within a text control
Cliff Wells
LogiplexSoftware at earthlink.net
Thu Nov 21 18:02:19 EST 2002
On Thu, 2002-11-21 at 10:24, F. GEIGER wrote:
> I'd like to catch mouse click events within a text control and then read the
> mouse pointer position. Alas, the only events I found in the dox are,
> EVT_TEXT, EVT_TEXT_ENTER, EVT_TEXT_URL, EVT_TEXT_MAXLEN.
Those events are specific to the wxTextCtrl, but you can also use the
events that are common to *all* controls:
from wxPython.wx import *
class ClickableText(wxTextCtrl):
def __init__(self, parent, id):
wxTextCtrl.__init__(self, parent, id)
EVT_LEFT_DOWN(self, self.OnClick)
def OnClick(self, event):
print event.GetX(), event.GetY()
raise SystemExit
app = wxPySimpleApp()
frame = wxDialog(None, -1, "Test")
text = ClickableText(frame, -1)
frame.ShowModal()
--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20021121/efc14267/attachment.sig>
More information about the Python-list
mailing list