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 ))
self .InitUI()
def InitUI( self ):
pnl = wx.Panel( self )
lblList = [ 'Radio One' , 'Radio Two' ]
self .rbox = wx.RadioBox(pnl, label = 'RadioBox' , pos = ( 80 , 10 ), choices = lblList,
majorDimension = 1 , style = wx.RA_SPECIFY_ROWS)
self .rbox.ShowItem( 0 , False )
self .Centre()
self .SetSize(( 400 , 250 ))
self .Show( True )
ex = wx.App()
FrameUI( None , 'RadioButton and RadioBox' )
ex.MainLoop()
|
Output Window:
Last Updated :
01 Mar, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...