[wxPython-users] wx.EVT_TEXT_ENTER

Andrea Gavana andrea.gavana at gmail.com
Tue Feb 5 09:13:48 PST 2008


Hi Aigars,

On Feb 5, 2008 4:46 PM, Aigars wrote:
> Aigars:
> > looks like wx.EVT_TEXT_ENTER does not happens.
>
> Robin Dunn:
> > Which version of wxPython?  Can you make a small sample that shows the
> > problem?
>
> Aigars:
>
> wxGTK-2.8.7 and wxPython-2.8.7.1, both installed seperately. wxGTK first.


You need to pass wx.TE_PROCESS_ENTER style to your wx.TextCtrl,
otherwise no processing of the "Enter" key is possible.


> There is code sample:
>
>
> import wx
>
>
> class Form_Main(wx.Frame):
>    def __init__(self, *args, **kwds):
>        # begin wxGlade: Form_Main.__init__
>        kwds["style"] = wx.DEFAULT_FRAME_STYLE
>        wx.Frame.__init__(self, *args, **kwds)
>        self.SetTitle("wx.EVT_TEXT_ENTER doesnot happens :( ")
>        self.SetSize((900, 500))
>
>        self.panel_1 = wx.Panel(self, -1)
>        self.panel_1.SetMinSize((300, 100))
>
>        self.label_Date = wx.StaticText(self.panel_1, -1, "Date...")
>        self.label_Date.SetMinSize((80, 15))
>        self.text_Date = wx.TextCtrl(self.panel_1, -1, "")


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


>        self.text_Date.SetMinSize((80, 20))
>        self.text_Date.Bind(wx.EVT_TEXT_ENTER, self.text_Date_update ,
> self.text_Date)
>
>        sizer_Date = wx.BoxSizer(wx.HORIZONTAL)
>        sizer_Date.Add(self.label_Date, 0, wx.ALL, 5)
>        sizer_Date.Add(self.text_Date, 0, wx.ALL|wx.ALIGN_RIGHT, 5)
>
>        self.panel_1.SetSizer(sizer_Date)
>
>    def text_Date_update():
>        print self.text_Date.GetValue()
>
>
> class MyApp(wx.App):
>    def OnInit(self):
>        wx.InitAllImageHandlers()
>        GLapp = Form_Main(None, -1, "")
>        self.SetTopWindow(GLapp)
>        GLapp.Show()
>        return 1
>
> # end of class MyApp
>
> if __name__ == "__main__":
>    app = MyApp(0)
>    app.MainLoop()
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>



Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/




More information about the wxpython-users mailing list