wxPython – GetLabel() function in wx.Button
Last Updated :
18 Jun, 2020
In this article, we are going to learn about GetLabel() function associated with wx.Button class of wxPython. GetLabel() function is used to return the string label for the button. No parameters are required by GetLabel() function.
Syntax: wx.Button.GetLabel(self)
Parameters: No parameters are required in GetLabel() function.
Return Type: string
Code Example:
import wx
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 .btn = wx.Button( self .pnl, label = 'Button' ,
pos = ( 20 , 20 ), size = ( 100 , 20 ))
s = self .btn.GetLabel()
print (s)
self .SetSize(( 350 , 250 ))
self .SetTitle( 'wx.Button' )
self .Centre()
def main():
app = wx.App()
ex = Example( None )
ex.Show()
app.MainLoop()
if __name__ = = '__main__' :
main()
|
Console Output:
Button
Output Window:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...