Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

wxPython – Create Radio Button using Create() function

  • Last Updated : 01 Aug, 2020

Create() function is used for the two-step construction of Radio Button in wxPython. Create() function takes different attributes of radio button as an argument

Syntax:  wx.RadioButton.Create(parent, id=ID_ANY, label=””, pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=RadioButtonNameStr )


ParameterInput TypeDescription
parentwx.WindowParent window. Should not be None.
idwx.WindowIDControl identifier. A value of -1 denotes a default value.
labelstringText Label.
poswx.PointWindow position.
sizewx.WindowWindow size.
stylelongWindow style.
validatorwx.ValidatorWindow validator.
namestringWindow name.



# importing wx library
import wx
# create an Example class
class Example(wx.Frame):
    # constructor
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
        # method calling
    # method for user interface creation
    def InitUI(self):
        # create parent panel in frame for radio button
        self.pnl = wx.Panel(self)
        # initialize radio button
        self.rb = wx.RadioButton()
        # create radio button with two step creation
        self.rb.Create(self.pnl, id = 1,
                       label = "Radio",
                       pos = (20,20))
# main function
def main():
  # create an App object
  app = wx.App()
  # create an Example object
  ex = Example(None)
  # running an app
# Driver code
if __name__ == '__main__':
  # main function call


Radio button in wxpython

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!