| | |
wxPython: wx.RadioButtons SetValue has no affect in Linux
![]() |
Hello,
I have a program written up that is trying to use buttons to turn on and off the radiobuttons themselves. IF the user clicks on the radiobutton itself, then it should have no affect. This simulates a sort of UI touch screen affect, with the radiobuttons themselves looking like LED indicators. The radiobuttons by default should all be uncheck to start. Now. This works in Windows wxPython IDLE program. This does not however work in the Linux I have here at school. I cannot get SetValue to have an affect at all, and all the radiobuttons are checked on when I start the application, which I do not want. I want them only to be checked on when I press a given button. The code for setting them up looks like this:
And then each monday through sunday function looks like this for the button and then the radiobutton indicator respectively.
If anyone can help me to figure out why it doesn't work in Linux and also how to make it work, I would greatly appreciate it. Thank you.
I have a program written up that is trying to use buttons to turn on and off the radiobuttons themselves. IF the user clicks on the radiobutton itself, then it should have no affect. This simulates a sort of UI touch screen affect, with the radiobuttons themselves looking like LED indicators. The radiobuttons by default should all be uncheck to start. Now. This works in Windows wxPython IDLE program. This does not however work in the Linux I have here at school. I cannot get SetValue to have an affect at all, and all the radiobuttons are checked on when I start the application, which I do not want. I want them only to be checked on when I press a given button. The code for setting them up looks like this:
Python Syntax (Toggle Plain Text)
#variables to see button clicked or not self.monOn = False self.tueOn = False self.wedOn = False self.thuOn = False self.friOn = False self.satOn = False self.sunOn = False #buttons and their events mon = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('mon.jpg'), '', wx.DefaultPosition, (53,34)) mon.SetBackgroundColour('#284c4c') mon.Bind(wx.EVT_BUTTON, self.setMon) tue = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('Tue.jpg'), '', wx.DefaultPosition, (53,34)) tue.SetBackgroundColour('#284c4c') tue.Bind(wx.EVT_BUTTON, self.setTue) wed = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('wed.jpg'), '', wx.DefaultPosition, (53,34)) wed.SetBackgroundColour('#284c4c') wed.Bind(wx.EVT_BUTTON, self.setWed) thu = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('thu.jpg'), '', wx.DefaultPosition, (53,34)) thu.SetBackgroundColour('#284c4c') thu.Bind(wx.EVT_BUTTON, self.setThu) fri = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('fri.jpg'), '', wx.DefaultPosition, (53,34)) fri.SetBackgroundColour('#284c4c') fri.Bind(wx.EVT_BUTTON, self.setFri) sat = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('sat.jpg'), '', wx.DefaultPosition, (53,34)) sat.SetBackgroundColour('#284c4c') sat.Bind(wx.EVT_BUTTON, self.setSat) sun = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('sun.jpg'), '', wx.DefaultPosition, (53,34)) sun.SetBackgroundColour('#284c4c') sun.Bind(wx.EVT_BUTTON, self.setSun) #radio buttons for active or not active day of week self.monAc = wx.RadioButton(weekPanel, 50, '', (10, 10),style=wx.RB_GROUP) self.monAc.SetValue(False) self.monAc.Bind(wx.EVT_RADIOBUTTON, self.monActv) self.tueAc = wx.RadioButton(weekPanel, 51, '', (10, 10),style=wx.RB_GROUP) self.tueAc.SetValue(False) self.tueAc.Bind(wx.EVT_RADIOBUTTON, self.tueActv) self.wedAc = wx.RadioButton(weekPanel, 52, '', (10, 10),style=wx.RB_GROUP) self.wedAc.SetValue(False) self.wedAc.Bind(wx.EVT_RADIOBUTTON, self.wedActv) self.thuAc = wx.RadioButton(weekPanel, 53, '', (10, 10),style=wx.RB_GROUP) self.thuAc.SetValue(False) self.thuAc.Bind(wx.EVT_RADIOBUTTON, self.thuActv) self.friAc = wx.RadioButton(weekPanel, 54, '', (10, 10),style=wx.RB_GROUP) self.friAc.SetValue(False) self.friAc.Bind(wx.EVT_RADIOBUTTON, self.friActv) self.satAc = wx.RadioButton(weekPanel, 55, '', (10, 10),style=wx.RB_GROUP) self.satAc.SetValue(False) self.satAc.Bind(wx.EVT_RADIOBUTTON, self.satActv) self.sunAc = wx.RadioButton(weekPanel, 56, '', (10, 10),style=wx.RB_GROUP) self.sunAc.SetValue(False) self.sunAc.Bind(wx.EVT_RADIOBUTTON, self.sunActv) weekBox.AddMany([ (mon, 1, wx.ALIGN_CENTER ), (tue, 1, wx.ALIGN_CENTER ), (wed, 1, wx.ALIGN_CENTER ), (thu, 1, wx.ALIGN_CENTER ), (fri, 1, wx.ALIGN_CENTER ), (sat, 1, wx.ALIGN_CENTER ), (sun, 1, wx.ALIGN_CENTER ), (self.monAc, 1, wx.ALIGN_CENTER ), (self.tueAc, 1, wx.ALIGN_CENTER ), (self.wedAc, 1, wx.ALIGN_CENTER ), (self.thuAc, 1, wx.ALIGN_CENTER ), (self.friAc, 1, wx.ALIGN_CENTER ), (self.satAc, 1, wx.ALIGN_CENTER ), (self.sunAc, 1, wx.ALIGN_CENTER ) ])
And then each monday through sunday function looks like this for the button and then the radiobutton indicator respectively.
Python Syntax (Toggle Plain Text)
#these are a group of events for monday through sunday actions def setMon(self,event): "''" if self.monOn == False: self.monOn = True self.monAc.SetValue(True) self.SetStatusText("Mon On") else: self.monOn = False self.monAc.SetValue(False) self.SetStatusText("Mon Off") def monActv(self,event): "''" if self.monOn == False: self.monAc.SetValue(False) self.SetStatusText("Mon Off") else: self.monAc.SetValue(True) self.SetStatusText("Mon On")
If anyone can help me to figure out why it doesn't work in Linux and also how to make it work, I would greatly appreciate it. Thank you.
![]() |
Similar Threads
- Graphics User Interface for Beginners (Python)
- Also Ran- Novell Suse Linux 10.0 (Getting Started and Choosing a Distro)
- Defragmenting Windows 98's Partition with Windows XP (Dual-boot) (Windows NT / 2000 / XP)
- wxPython and Mandriva 2005 LE (Python)
- wxPython slider help (Python)
- run different versions of wxPython (Python)
- which linux for gaming? (Getting Started and Choosing a Distro)
- WINDOWS vs LINUX (Windows NT / 2000 / XP)
- Do you need AV and Firewall? (Windows NT / 2000 / XP)
Other Threads in the Python Forum
- Previous Thread: just for fun
- Next Thread: Nifty little network project.
| Thread Tools | Search this Thread |
abrupt accessdenied anti apache application approximation argv array beginner book builtin calculator change converter countpasswordentry curved dan08 dictionaries dictionary dynamic edit enter examples file float format function gui heads homework import inches input java keyboard lapse launcher library line lines linux list lists loop microphone mouse movingimageswithpygame mysqlquery newb number numbers numeric output parameters parsing path phonebook plugin port prime programming projects py2exe pygame pyopengl python random recursion redirect remote reverse scrolledtext session simple software sprite statictext string strings syntax table terminal text textarea thread threading time tlapse trick tuple tutorial twoup ubuntu unicode unit urllib urllib2 variable wordgame wxpython





