[Tutor] Why SelectAll() cannot work well ?

johnf jfabiani at yolo.com
Thu Nov 30 18:13:22 CET 2006


On Thursday 30 November 2006 00:13, Jia Lu wrote:
> import wx
>
> ComboList = ['Akari', 'Aika', 'Alice']
>
> class MyApp(wx.App):
>     def OnInit(self):
>         frame = wx.Frame(None, -1, "ARIA", size=(250, 100))
>         frame.Show()
>
>         self.CBox = wx.ComboBox(frame, -1, "Alicia", pos=(20, 20),
> size=(100,30), choices=ComboList)
>         self.Text = wx.StaticText(frame, -1, "ARIA", pos=(20,50))
>         # Note: EVT
>         self.CBox.Bind(wx.EVT_COMBOBOX, self.OnSelect)
>         self.CBox.Bind(wx.EVT_TEXT_ENTER, self.OnEnter)
>         #self.CBox.SetSelection(2)
>         return 1
>
>     def OnSelect(self, event):
>         Text = self.CBox.GetStringSelection()
>         self.Text.SetLabel(Text)
>
>     def OnEnter(self, event):
>         Text = self.CBox.GetValue()
>         self.Text.SetLabel(Text)
>         self.CBox.SetFocus()
>         self.CBox.SelectAll()
>
> app = MyApp()
> app.MainLoop()
SUSE 10.1 python 2.4.3 wxPython 2.6.?
works for me
-- 
John Fabiani


More information about the Tutor mailing list