The code loads without error, but before you can type and hit enter, the wx.EVT_TEXT_ENTER() runs the killProcs() function. (I know because I have killProcs output text to a different wx.TextCtrl box.
I thought wx.EVT_TEXT_ENTER() wouldn't execute until "enter" had been pressed while this TextCtrl had focus?
Sample code seems extremely hard to come by. Blind trial and error and this medium are the only ways I'm making any headway
The code loads without error, but before you can type and hit enter, the wx.EVT_TEXT_ENTER() runs the killProcs() function. (I know because I have killProcs output text to a different wx.TextCtrl box.
I thought wx.EVT_TEXT_ENTER() wouldn't execute until "enter" had been pressed while this TextCtrl had focus?
Yes, that is the way it is supposed to work. Please duplicate this problem in a small sample and send it here. Also report your platform and version.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
The code loads without error, but before you can type and hit enter, the wx.EVT_TEXT_ENTER() runs the killProcs() function. (I know because I have killProcs output text to a different wx.TextCtrl box.
I thought wx.EVT_TEXT_ENTER() wouldn't execute until "enter" had been pressed while this TextCtrl had focus?
Yes, that is the way it is supposed to work. Please duplicate this problem in a small sample and send it here. Also report your platform and version.
It sure looks to me like "self.killProcs(list)" would run self.killProcs, and then whatever is returned is passed to EVT_TEXT_ENTER.
What you need is a simpler function like this:
def killProcs(self, list):
# This one doesn't change
def onKillProcs(self, event):
# This is just a wrapper for the other one
self.killProcs(self.killProcsList)
self.killProcsList = list
wx.EVT_TEXT_ENTER(self.control1, -1, self.onKillProcs)
Now when Enter is pressed, it will send the event to onKillProcs, which then calls self.killProcs. You need to keep the list somewhere such that "onKillProcs" has access to it.
The code loads without error, but before you can type and hit enter, the wx.EVT_TEXT_ENTER() runs the killProcs() function. (I know because I have killProcs output text to a different wx.TextCtrl box.
I thought wx.EVT_TEXT_ENTER() wouldn't execute until "enter" had been pressed while this TextCtrl had focus?
Yes, that is the way it is supposed to work. Please duplicate this problem in a small sample and send it here. Also report your platform and version.
It sure looks to me like "self.killProcs(list)" would run self.killProcs, and then whatever is returned is passed to EVT_TEXT_ENTER.
Oops, thanks for spotting that.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!