Friday, November 15, 2024
Google search engine
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 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