Re: help with getting selection from wxChoice with out after it has changed
[..join(['fred','dixon'] wrote: > I want to get the selection of several wxChoice boxes. > But i do not want to have to catch the events for all the boxes > I should be able to access the current selection outside of an > event,but i am not seeing how to do this. > #def EvtChoice(self, event): > #print('EvtChoice: %s\n' % event.GetString()) > #self.ch.Append("A new item") > # > ##-changed here - from event.GetSelection() > #if self.ch.GetSelection() == 'one': > #print('Well done!\n') Perhaps you are confused by the fact that GetSelection() returns an integer? Changing the above to either if self.ch.GetStringSelection() == 'one': print 'Well done!' or if self.ch.GetSelection() == 1: print 'Well done, too!' should work as you expect then. Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: help with getting selection from wxChoice with out after it has changed
'@'.join([..join(['fred', 'dixon']), ..join(['gmail', 'com'])]) wrote: > From: "'@'.join([..join(['fred', 'dixon']), ..join(['gmail', 'com'])])" > <[EMAIL PROTECTED]> This is a SyntaxError. You want to enclose the dots with '' marks as well, like this: '@'.join(['.'.join(['fred', 'dixon']), '.'.join(['gmail', 'com'])]) regards, Gerrit Holl. -- Weather in Twenthe, Netherlands 29/03 10:55: 10.0ÂC mist overcast wind 0.9 m/s None (57 m above NAP) -- In the councils of government, we must guard against the acquisition of unwarranted influence, whether sought or unsought, by the military-industrial complex. The potential for the disastrous rise of misplaced power exists and will persist. -Dwight David Eisenhower, January 17, 1961 -- http://mail.python.org/mailman/listinfo/python-list
help with getting selection from wxChoice with out after it has changed
I want to get the selection of several wxChoice boxes. But i do not want to have to catch the events for all the boxes I should be able to access the current selection outside of an event,but i am not seeing how to do this. This is a hack of the wxpython choice demo to demonstrate my question #- comment marks are for indention #import wx #class TestChoice(wx.Dialog): #def __init__(self, parent): ##self.log = log #wx.Dialog.__init__(self, parent, -1) # #sampleList = ['zero', 'one', 'two', 'three', 'four', 'five', # 'six', 'seven', 'eight'] # #wx.StaticText(self, -1, "This example uses the wxChoice control.", (15, 10)) #wx.StaticText(self, -1, "Select one:", (15, 50), (75, -1)) #self.ch = wx.Choice(self, -1, (100, 50), choices = sampleList) #self.Bind(wx.EVT_CHOICE, self.EvtChoice, self.ch) # # #def EvtChoice(self, event): #print('EvtChoice: %s\n' % event.GetString()) #self.ch.Append("A new item") # ##-changed here - from event.GetSelection() #if self.ch.GetSelection() == 'one': #print('Well done!\n') # # #if __name__ == "__main__": #app = wx.PySimpleApp(0) #wx.InitAllImageHandlers() #Dialog_Main = TestChoice(None) #app.SetTopWindow(Dialog_Main) #Dialog_Main.Show() #app.MainLoop() -- http://mail.python.org/mailman/listinfo/python-list