Skip to content
Related Articles
Open in App
Not now

Related Articles

wxPython – Disable Radio button

Improve Article
Save Article
Like Article
  • Last Updated : 24 Jun, 2020
Improve Article
Save Article
Like Article

In this article we are going to learn about how can we disable a radio button present in a frame. Sometimes when we dont want user to press a button we can disable a button and the button become unclickable.
In order to disable a button we can use Disable() function associated with wx.RadioButton class of wxPython.

Syntax: wx.RadioButton.Disable(self)

Parameters: No parameters are required by Disable() function

Return Type: bool

Returns: Returns True if the window has been disabled, False if it had been already disabled before the call to this function.

Code Example:

import wx
class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
    def InitUI(self):
        # create parent panel for radio buttons
        self.pnl = wx.Panel(self)
        # create radio button at position (30, 10)
        self.rb1 = wx.RadioButton(self.pnl, label ='Btn1'
                             pos =(30, 10), size =(100, 20))
        # disable the radio button
def main():
    app = wx.App()
    ex = Example(None)
if __name__ == '__main__':

Output Window:

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!