473,581 Members | 2,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_ENT ER can not be caught, that is, key code of RETURN
can not be indentified.

class MyDialog(wx.Dia log):
def __init__(self,p arent,pos,size, style):
...
self.t1 = wx.TextCtrl(sel f, -1, "", size=(125, -1))
self.t1.Bind(wx .EVT_CHAR, self.OnChar,sel f.t1)
...

def OnChar(self, event):
if (event.GetKeyCo de() == 13):
print "%d"%event.GetK eyCode()
else:
print "%d"%event.GetK eyCode()
event.Skip()
How could I effectively bind a handler to EVT_TEXT_ENTER in it?
Thanks,
Sean
Jul 18 '05 #1
1 3458
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_ENT ER can not be caught, that is, key code of RETURN
can not be indentified.

class MyDialog(wx.Dia log):
def __init__(self,p arent,pos,size, style):
...
self.t1 = wx.TextCtrl(sel f, -1, "", size=(125, -1))
self.t1.Bind(wx .EVT_CHAR, self.OnChar,sel f.t1)
...

def OnChar(self, event):
if (event.GetKeyCo de() == 13):
print "%d"%event.GetK eyCode()
else:
print "%d"%event.GetK eyCode()
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(sel f, -1, "", style = wx.TE_PROCESS_E NTER)

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
2413
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 either the list.extend method or even by having the subclass create a whole new list in the variable. The following example illustrates the...
1
1649
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 different text for closing certain dialogs in the program. (it's a pure "do you want to exit <insert screen name>" dialog) What would i better use,...
4
1377
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 box when double clicking on a edit box. I tried using the OnLButtonDblClk, but it does not work when double clicking on the edit box though it...
0
1146
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 following error msg.... An unhandled exception has been caught by the VSW exception filter. I have removed and reinstalled VS.net, and it didnt solve...
8
1663
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 function (particularly, subclass file which is returned from open). I would add some extra functionality and keep the base functions, too. But I...
0
5652
bartonc
by: bartonc | last post by:
#Boa:Dialog:DBConnectDialog import wx import wxdbtools as db def create(parent): return DBConnectDialog(parent) =
0
1603
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, MySQLSelect
0
7688
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 dbConnect to None. ## spec: dict(UserName=name, Password=pswd, ServerName=host) ## Allow names to be set with Default Holder. Consiter...
0
5232
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): #, database="" """Attempt to create a database login. If successful, return an open connection. Otherwise, return None."""
0
7882
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7808
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8312
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6564
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5683
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3835
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1410
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.