Thursday, September 25, 2025
HomeLanguageswxPython – ShowItem() method in wx.RadioBox

wxPython – ShowItem() method in wx.RadioBox

In this article we are going to learn about ShowItem() method associated with the wx.RadioBox class of wxPython. ShowItem() method is a simple method used in order to show or hide individual buttons. ShowItem() method returns True if the item has been shown or hidden or False if nothing was done because it already was in the requested state.

Syntax: wx.RadioBox.ShowItem(self, item, show=True) Parameters

Parameter Input Type Description
item int The zero-based position of the button to show or hide.
show bool True to show, False to hide.

Return Type: bool Returns: True if the item has been shown or hidden or False if nothing was done because it already was in the requested state.

Code Example: 

Python3




import wx
 
 
class FrameUI(wx.Frame):
 
    def __init__(self, parent, title):
        super(FrameUI, self).__init__(parent, title = title, size =(300, 200))
 
        # function for in-frame components
        self.InitUI()
 
    def InitUI(self):
        # parent panel for radio box
        pnl = wx.Panel(self)
 
        # list of choices
        lblList = ['Radio One', 'Radio Two']
 
        # create radio box containing above list
        self.rbox = wx.RadioBox(pnl, label ='RadioBox', pos =(80, 10), choices = lblList,
                                          majorDimension = 1, style = wx.RA_SPECIFY_ROWS)
 
        # show item at position 0
        self.rbox.ShowItem(0, False)
 
        # set frame in centre
        self.Centre()
        # set size of frame
        self.SetSize((400, 250))
        # show output frame
        self.Show(True)
 
 
# wx App instance
ex = wx.App()
# Example instance
FrameUI(None, 'RadioButton and RadioBox')
ex.MainLoop()


Output Window:

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

Most Popular

Dominic
32320 POSTS0 COMMENTS
Milvus
84 POSTS0 COMMENTS
Nango Kala
6683 POSTS0 COMMENTS
Nicole Veronica
11854 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11910 POSTS0 COMMENTS
Shaida Kate Naidoo
6795 POSTS0 COMMENTS
Ted Musemwa
7071 POSTS0 COMMENTS
Thapelo Manthata
6754 POSTS0 COMMENTS
Umr Jansen
6762 POSTS0 COMMENTS