Monday, November 18, 2024
Google search engine
HomeLanguageswxPython – Enable() function in wx.RadioButton

wxPython – Enable() function in wx.RadioButton

In this article we will learn about Enable() function associated with wx.RadioButton class of wxPython. Enable() function is simply used to enable or disable the Radio Button for user input. It takes a boolean argument True to Enable and False to disable.

Syntax: wx.RadioButton.Enable(self, enable=True)

Parameters:

Parameter Input Type Description
enable bool If True, enables the window for input. If False, disables the window.

Return Type: bool

Returns: True if the window has been enabled or disabled, False if nothing was done, i.e. if the window had already been in the specified state.

Code Example:




import wx
  
APP_EXIT = 1
  
  
class Example(wx.Frame):
  
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
  
        self.InitUI()
  
    def InitUI(self):
        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 using Enable() function
        self.rb1.Enable(False)
  
  
def main():
    app = wx.App()
    ex = Example(None)
    ex.Show()
    app.MainLoop()
  
  
if __name__ == '__main__':
    main()


Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments