Skip to content
Related Articles

Related Articles

wxPython – SetAuthNeeded() function in wx.Button

Improve Article
Save Article
Like Article
  • Last Updated : 18 Jun, 2020

In this article we are going to learn about SetAuthNeeded() function associated with wx.Button class of wxPython. SetAuthNeeded() function is used to set whether an authentication needed symbol should be displayed on the button.

It takes only boolean argument, that is, needed or not.

Syntax: wx.Button.SetAuthNeeded(self, needed=True)

Parameters:

ParameterInput TypeDescription
neededboolTrue for needed and False for not needed.

Return Type: bool

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))
          
        # SET NEEDED AS TRUE 
        self.btn.SetAuthNeeded(True)
        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()

Output Window:

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!