Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-06-17
1
Medium Priority
?
480 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 200 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

The really strange introduction Once upon a time there were individuals who intentionally put the grass seeds to the soil with anticipation of solving their nutrition problems. Or they maybe only played with seeds and noticed what happened... Som…
Strings in Python are the set of characters that, once defined, cannot be changed by any other method like replace. Even if we use the replace method it still does not modify the original string that we use, but just copies the string and then modif…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Suggested Courses

927 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