Friday, November 14, 2025
HomeLanguageswxPython – GetAuthNeeded() function in wx.Button

wxPython – GetAuthNeeded() function in wx.Button

In this article we are going to learn about GetAuthNeeded() function associated with wx.Button class of wxPython. GetAuthNeeded() function is used to return True if an authentication needed symbol is displayed on the button.
It takes no arguments.

Syntax: wx.Button.GetAuthNeeded(self)

Parameters: No parameters are required by GetAuthNeeded() function.

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))
        self.btn.SetAuthNeeded(True)
  
        # PRINT IF AUTHENTICATION IS NEEDED OR NOT USING GetAuthNeeded()
        if(self.btn.GetAuthNeeded()== True):
            print("Authentication is needed.")
        else:
            print("No Authentication is needed.")
        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:

Authentication is needed.

Output Window:

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

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6765 POSTS0 COMMENTS
Nicole Veronica
11917 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11984 POSTS0 COMMENTS
Shaida Kate Naidoo
6889 POSTS0 COMMENTS
Ted Musemwa
7141 POSTS0 COMMENTS
Thapelo Manthata
6837 POSTS0 COMMENTS
Umr Jansen
6839 POSTS0 COMMENTS