wxPython: wx.RadioButtons SetValue has no affect in Linux

Reply

Join Date: Jan 2005
Posts: 56
Reputation: kharri5 is an unknown quantity at this point 
Solved Threads: 0
kharri5's Avatar
kharri5 kharri5 is offline Offline
Junior Poster in Training

wxPython: wx.RadioButtons SetValue has no affect in Linux

 
0
  #1
Feb 14th, 2007
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:

  1. #variables to see button clicked or not
  2. self.monOn = False
  3. self.tueOn = False
  4. self.wedOn = False
  5. self.thuOn = False
  6. self.friOn = False
  7. self.satOn = False
  8. self.sunOn = False
  9.  
  10. #buttons and their events
  11. mon = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('mon.jpg'), '', wx.DefaultPosition, (53,34))
  12. mon.SetBackgroundColour('#284c4c')
  13. mon.Bind(wx.EVT_BUTTON, self.setMon)
  14. tue = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('Tue.jpg'), '', wx.DefaultPosition, (53,34))
  15. tue.SetBackgroundColour('#284c4c')
  16. tue.Bind(wx.EVT_BUTTON, self.setTue)
  17. wed = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('wed.jpg'), '', wx.DefaultPosition, (53,34))
  18. wed.SetBackgroundColour('#284c4c')
  19. wed.Bind(wx.EVT_BUTTON, self.setWed)
  20. thu = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('thu.jpg'), '', wx.DefaultPosition, (53,34))
  21. thu.SetBackgroundColour('#284c4c')
  22. thu.Bind(wx.EVT_BUTTON, self.setThu)
  23. fri = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('fri.jpg'), '', wx.DefaultPosition, (53,34))
  24. fri.SetBackgroundColour('#284c4c')
  25. fri.Bind(wx.EVT_BUTTON, self.setFri)
  26. sat = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('sat.jpg'), '', wx.DefaultPosition, (53,34))
  27. sat.SetBackgroundColour('#284c4c')
  28. sat.Bind(wx.EVT_BUTTON, self.setSat)
  29. sun = GenBitmapTextButton(weekPanel, 24, wx.Bitmap('sun.jpg'), '', wx.DefaultPosition, (53,34))
  30. sun.SetBackgroundColour('#284c4c')
  31. sun.Bind(wx.EVT_BUTTON, self.setSun)
  32.  
  33. #radio buttons for active or not active day of week
  34. self.monAc = wx.RadioButton(weekPanel, 50, '', (10, 10),style=wx.RB_GROUP)
  35. self.monAc.SetValue(False)
  36. self.monAc.Bind(wx.EVT_RADIOBUTTON, self.monActv)
  37. self.tueAc = wx.RadioButton(weekPanel, 51, '', (10, 10),style=wx.RB_GROUP)
  38. self.tueAc.SetValue(False)
  39. self.tueAc.Bind(wx.EVT_RADIOBUTTON, self.tueActv)
  40. self.wedAc = wx.RadioButton(weekPanel, 52, '', (10, 10),style=wx.RB_GROUP)
  41. self.wedAc.SetValue(False)
  42. self.wedAc.Bind(wx.EVT_RADIOBUTTON, self.wedActv)
  43. self.thuAc = wx.RadioButton(weekPanel, 53, '', (10, 10),style=wx.RB_GROUP)
  44. self.thuAc.SetValue(False)
  45. self.thuAc.Bind(wx.EVT_RADIOBUTTON, self.thuActv)
  46. self.friAc = wx.RadioButton(weekPanel, 54, '', (10, 10),style=wx.RB_GROUP)
  47. self.friAc.SetValue(False)
  48. self.friAc.Bind(wx.EVT_RADIOBUTTON, self.friActv)
  49. self.satAc = wx.RadioButton(weekPanel, 55, '', (10, 10),style=wx.RB_GROUP)
  50. self.satAc.SetValue(False)
  51. self.satAc.Bind(wx.EVT_RADIOBUTTON, self.satActv)
  52. self.sunAc = wx.RadioButton(weekPanel, 56, '', (10, 10),style=wx.RB_GROUP)
  53. self.sunAc.SetValue(False)
  54. self.sunAc.Bind(wx.EVT_RADIOBUTTON, self.sunActv)
  55.  
  56. weekBox.AddMany([ (mon, 1, wx.ALIGN_CENTER ),
  57. (tue, 1, wx.ALIGN_CENTER ),
  58. (wed, 1, wx.ALIGN_CENTER ),
  59. (thu, 1, wx.ALIGN_CENTER ),
  60. (fri, 1, wx.ALIGN_CENTER ),
  61. (sat, 1, wx.ALIGN_CENTER ),
  62. (sun, 1, wx.ALIGN_CENTER ),
  63. (self.monAc, 1, wx.ALIGN_CENTER ),
  64. (self.tueAc, 1, wx.ALIGN_CENTER ),
  65. (self.wedAc, 1, wx.ALIGN_CENTER ),
  66. (self.thuAc, 1, wx.ALIGN_CENTER ),
  67. (self.friAc, 1, wx.ALIGN_CENTER ),
  68. (self.satAc, 1, wx.ALIGN_CENTER ),
  69. (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.

  1. #these are a group of events for monday through sunday actions
  2. def setMon(self,event):
  3. "''"
  4. if self.monOn == False:
  5. self.monOn = True
  6. self.monAc.SetValue(True)
  7. self.SetStatusText("Mon On")
  8. else:
  9. self.monOn = False
  10. self.monAc.SetValue(False)
  11. self.SetStatusText("Mon Off")
  12.  
  13. def monActv(self,event):
  14. "''"
  15. if self.monOn == False:
  16. self.monAc.SetValue(False)
  17. self.SetStatusText("Mon Off")
  18. else:
  19. self.monAc.SetValue(True)
  20. 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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC