Solved

Use Toggle Buttons as Radio buttons, how to un-toggle other buttons when one is selected

Posted on 2008-06-17
1
463 Views
Last Modified: 2012-05-05
I'm Trying to use toggle buttons as radio buttons and have been unable to get the other buttons to
be de-selected.

There are 3 buttons each has a selected icon and unselected icon.

When I click any of them the selected icon gets displayed and when I click the same button the unselected
icon is displayed, but only for the button clicked. I want to select any button and make the 2 others
unselected.

I've tried
def OnButtonOne(self, event):
      self.buttonTwo.SetSelected(false)
      self.buttonThree.SetSelected(false)

also
def OnButtonOne(self, event):
      self.buttonTwo.SetSelected(false)
      self.buttonTwo.Show()
      self.buttonThree.SetSelected(false)
      self.buttonTwo.Show()

also
def OnButtonOne(self, event):
      self.buttonTwo.SetActive(false)
      self.buttonTwo.Show()
      self.buttonThree.SetActive(false)
      self.buttonTwo.Show()

In another language I remember doing something like
buttonTwo.doClick()
buttonThree.doClick()

But I don't know if Python has something like this

How can I toggle the other two buttons when any one of them is selected?
0
Comment
Question by:mitchguy
1 Comment
 
LVL 25

Accepted Solution

by:
clockwatcher earned 50 total points
ID: 21810107
Use the SetValue method.



    def OnToggleButton1Togglebutton(self, event):

        if self.toggleButton1.GetValue():

            self.toggleButton2.SetValue(0)

            self.toggleButton3.SetValue(0)
 

    def OnToggleButton2Togglebutton(self, event):

        if self.toggleButton2.GetValue():

            self.toggleButton1.SetValue(0)

            self.toggleButton3.SetValue(0)
 

    def OnToggleButton3Togglebutton(self, event):

         if self.toggleButton3.GetValue():

            self.toggleButton1.SetValue(0)

            self.toggleButton2.SetValue(0)

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Plenty of writing has gone on the web trying to compare Python with other competitive programming languages and vice versa. However, not much has been put into a wholistic perspective. This article should help you decide whether to adopt Python as a…
Here I am using Python IDLE(GUI) to write a simple program and save it, so that we can just execute it in future. Because when we write any program and exit from Python then program that we have written will be lost. So for not losing our program we…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now