python - Wxpython Radio Button Preselected -
i have 3 wxpython radio buttons. when run, first button (value a) selected. how make no buttons selected initially?
self.rb1 = wx.radiobutton(panel, -1, 'value a', (50, 10), style=wx.rb_group) self.rb2 = wx.radiobutton(panel, -1, 'value b', (10, 30)) self.rb3 = wx.radiobutton(panel, -1, 'value c', (10, 50)) self.bind(wx.evt_radiobutton, self.setval, id=self.rb1.getid()) self.bind(wx.evt_radiobutton, self.setval, id=self.rb2.getid()) self.bind(wx.evt_radiobutton, self.setval, id=self.rb3.getid())
using rb_group
makes buttons mutually exclusive , first button checked. if check 1 uncheck other. if don't need mutually exclusive buttons can use rb_single
each of buttons. see here docs.
hint
maybe workaround perhaps create hidden radio-button, selected on creation of group.
Comments
Post a Comment