473,386 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

EVT_TEXT_ENTER can not be caught in a subclass of wx.Dialog

Hi,
I found if a wx.TextCtrl is used in a subclass of wx.Dialog, the
event wx.EVT_TEXT_ENTER can not be caught, that is, key code of RETURN
can not be indentified.

class MyDialog(wx.Dialog):
def __init__(self,parent,pos,size,style):
...
self.t1 = wx.TextCtrl(self, -1, "", size=(125, -1))
self.t1.Bind(wx.EVT_CHAR, self.OnChar,self.t1)
...

def OnChar(self, event):
if (event.GetKeyCode() == 13):
print "%d"%event.GetKeyCode()
else:
print "%d"%event.GetKeyCode()
event.Skip()
How could I effectively bind a handler to EVT_TEXT_ENTER in it?
Thanks,
Sean
Jul 18 '05 #1
1 3447
On Tue, 2004-10-12 at 04:32 -0700, Sean wrote:
Hi,
I found if a wx.TextCtrl is used in a subclass of wx.Dialog, the
event wx.EVT_TEXT_ENTER can not be caught, that is, key code of RETURN
can not be indentified.

class MyDialog(wx.Dialog):
def __init__(self,parent,pos,size,style):
...
self.t1 = wx.TextCtrl(self, -1, "", size=(125, -1))
self.t1.Bind(wx.EVT_CHAR, self.OnChar,self.t1)
...

def OnChar(self, event):
if (event.GetKeyCode() == 13):
print "%d"%event.GetKeyCode()
else:
print "%d"%event.GetKeyCode()
event.Skip()
How could I effectively bind a handler to EVT_TEXT_ENTER in it?


You need to specify the following style for the textctrl:

self.t1 = wx.TextCtrl(self, -1, "", style = wx.TE_PROCESS_ENTER)

Regards,
Cliff

--
Cliff Wells <cl************@comcast.net>

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gerry Sutton | last post by:
Hi All! I have noticed a strange behavior when using a constant identifier to initialize an instance list variable in a base class and then trying to modifying the list in subclasses by using...
1
by: flupke | last post by:
I'm using wxPython and design the gui via wxglade. One of the gui components is a simple dialog class that gets displayed when a user exits the program. I want to use the same dialog but with a...
4
by: Z.K. | last post by:
I was wondering if someone could tell me how or point me to an appropriate web page that will show me how to subclass a control in vc++.net 2002. What I want to do is to be able to pop up a dialog...
0
by: Patricia Kline | last post by:
On a few of my projects, when i try to open them, i get the MS Developement Environment error dialog. When i click the: To see what data this error report contains, click here. It gives the...
8
by: Lou Pecora | last post by:
I've been scanning Python in a Nutshell, but this seems to be either undoable or so subtle that I don't know how to do it. I want to subclass a base class that is returned from a Standard Library...
0
bartonc
by: bartonc | last post by:
#Boa:Dialog:DBConnectDialog import wx import wxdbtools as db def create(parent): return DBConnectDialog(parent) =
0
bartonc
by: bartonc | last post by:
#Boa:Dialog:TiltCalibrate import wx import Multiply from PMD import DefaultMultiplier from time import sleep from string import digits from wxdbtools import MySQLInsert, MySQLUpdate,...
0
bartonc
by: bartonc | last post by:
#Boa:Dialog:DBConnectDialog import wx ##"""Given a set if login specs, create a dbServer instance and ## ensure that there is a valid, open connection to the database. ## If not, set the...
0
bartonc
by: bartonc | last post by:
from MySQLdb import * from time import time class DBServer: def __init__(self, master): self.master = master def Login(self, servername, username, password): #,...
0
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$) { } ...
0
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...
0
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
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.