Solved

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

Posted on 2008-06-17
1
462 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Python threading 1 60
Python frameworks - maybe Django. 4 85
run a set of files in Python 2 35
Merge lists using index in Python 1 61
Introduction On September 29, 2012, the Python 3.3.0 was released; nothing extremely unexpected,  yet another, better version of Python. But, if you work in Microsoft Windows, you should notice that the Python Launcher for Windows was introduced wi…
Article by: Swadhin
Introduction of Lists in Python: There are six built-in types of sequences. Lists and tuples are the most common one. In this article we will see how to use Lists in python and how we can utilize it while doing our own program. In general we can al…
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 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…

743 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

10 Experts available now in Live!

Get 1:1 Help Now