wxPython – Enable() function in wx.RadioButton
Last Updated :
26 Jun, 2020
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 )
self .rb1 = wx.RadioButton( self .pnl, label = 'Btn1' ,
pos = ( 30 , 10 ), size = ( 100 , 20 ))
self .rb1.Enable( False )
def main():
app = wx.App()
ex = Example( None )
ex.Show()
app.MainLoop()
if __name__ = = '__main__' :
main()
|
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...