[wxPython-users] Wx.EVT_TEXT Help.

Christopher Barker Chris.Barker at noaa.gov
Thu Jul 6 14:21:12 PDT 2006


Walter Igo wrote:
> I have a small program and I only want it to write the letter that I
> press to the text window. but I cant keep it form looping. 

I'm not sure what you want it to do, but if you don't catch any events, 
a Text control will let you type text in.

a few comments:

> self.TextWindow = wx.TextCtrl(panel,-1,'',size=(440,282),style=wx.TE_MULTILINE)
> panel.Bind(wx.EVT_TEXT,self.CharLoop,id=-1)

This is problematic, an ID of -1 indicates that you want the system to 
assign an ID. I'm surprised it works. A better way is:

self.TextWindow=wx.TextCtrl(panel,size=(440,282),style=wx.TE_MULTILINE)
self.TextWindow.Bind(wx.EVT_TEXT,self.CharLoop)

def CharLoop(self,event):
     print "while Statement Entered"
     text=self.TextWindow.GetValue()
     self.TextWindow.WriteText(text)

Again, I'm not sure what you want, but:
     text=self.TextWindow.GetValue()
     self.TextWindow.SetValue(text)

may work.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list