[wxPython-users] wx.EVT_TEXT_ENTER on wx.ComboBox
Andrea Gavana
andrea.gavana at gmail.com
Thu May 3 14:16:00 PDT 2007
Hi Daniele,
On 5/3/07, Expo wrote:
> wx.ComboBox doesn't fire wx.EVT_TEXT_ENTER event on wxPyhon 2.8.x under
> Win32
That depends on how you use it:
import wx
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
'six', 'seven', 'eight']
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "Hello wx.ComboBox", size=(400, 300))
panel = wx.Panel(self)
comboBox = wx.ComboBox(panel, -1, "default value", (20, 20),
(100, 20), sampleList,
wx.CB_DROPDOWN|wx.TE_PROCESS_ENTER)
self.Bind(wx.EVT_COMBOBOX, self.EvtComboBox, comboBox)
self.Bind(wx.EVT_TEXT, self.EvtText, comboBox)
self.Bind(wx.EVT_TEXT_ENTER, self.EvtTextEnter, comboBox)
self.CenterOnScreen()
self.Show()
def EvtComboBox(self, evt):
print 'EvtComboBox: %s' % evt.GetString()
# Capture events every time a user hits a key in the text entry field.
def EvtText(self, evt):
print 'EvtText: %s' % evt.GetString()
evt.Skip()
# Capture events when the user types something into the control then
# hits ENTER.
def EvtTextEnter(self, evt):
print 'DID YOU GET HERE?: EvtTextEnter: %s' % evt.GetString()
evt.Skip()
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = MyFrame()
app.MainLoop()
Though I might agree that using wx.TE_PROCESS_ENTER for a combobox is
not very intuitive... I don't know if it is a bug or the expected
behavior, maybe Robin can clarify my misunderstanding,,,
> Esposti Daniele
> Via Aldo Moro, 14/h
> 20085 - Locate di Triulzi (MI)
^^^^^^^^^^^^^^^^^^
How small is the world... that is exactly the same small village where
I come from and where I lived till March 2006 (and to which I come
back every month to see my parents). Small quiet corner of south Milan
:-D
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/
More information about the wxpython-users
mailing list