Please nominate your Qt Champions for 2021!

Authentication Rejected: No auth protocols/host-based auth failed

  • I am new to PyQt and am trying to learn the basics for GUI building. I am following a tutorial to build a window and a button that displays text, but I keep encountering this error. I am running a Manjaro distro with latest kernel.
    qt5ct: using qt5ct plugin
    Qt: Session management error: Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed

    # -*- coding: utf:8 -*-
    import sys
    from PyQt5.QtWidgets import (QWidget, QToolTip, 
        QPushButton, QApplication)
    from PyQt5.QtGui import QFont    
    class Example(QWidget):
        def __init__(self):
        def initUI(self):
            QToolTip.setFont(QFont('SansSerif', 10))
            self.setToolTip('This is a <b>QWidget</b> widget')
            btn = QPushButton('Button', self)
            btn.setToolTip('This is a <b>QPushButton</b> widget')
            btn.move(50, 50)       
            self.setGeometry(300, 300, 300, 200)
    if __name__ == '__main__':
        app = QApplication(sys.argv)
        ex = Example()

  • Banned

    In looking into this I actually found the example you pulled your version from and I suggest you do not use any more examples by that individual as they obviously do not know much about coding in python-qt

    from PyQt5.QtCore    import pyqtSlot
    from PyQt5.QtGui     import QFont
    from PyQt5.QtWidgets import QApplication, QWidget, QToolTip
    from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout, QPushButton
    # Note always import everything else after your PyQt imports
    class Example(QWidget):
        def __init__(self):
          # First do not use super( ) unless you are fully aware of what 3 major issues 
          # you must code for in conjunction with using it and the actual rare issue 
          # that it is meant to solve. Note this rare issue is rare and unless you are 
          # doing some complicated inheritance you will most likely never run into that
          # issue -- however the 3 major issues it creates by using it you are much more 
          # likely to run into than the rare issue its meant for
          # Further this implementation of super() was incorrect
          #  super().__init__()
          # It is always best to keep like things grouped and in some sort of order
          # layout for easier readability
            Top=300; Left=300; Width=250; Hight=100
            self.setGeometry(Left, Top, Width, Hight)
            MyFont = QFont('SansSerif', 10)
            self.setToolTip('This is a <b>QWidget</b> object')
            self.btnPush = QPushButton('Button', self)
            self.btnPush.setToolTip('This is a <b>QPushButton</b> object')
          # Normally you want one of these of some sort associated with your button
          # Windows are dynamic thus static placement is usually bad but sometimes
          # sometimes you want granular control in which case you use QGridLayout
          # self.btnPush.move(50, 50) 
          # This handles adding the Button to a Dynamic Horizontal container
            HBox = QHBoxLayout()
          # This handles adding the Dynamic Horizontal container into a 
          # Dynamic Vertical container
            VBox = QVBoxLayout()
          # Note: The combination of the HBox and VBox is used to put the
          # QPushbutton in the upper left corner of the QWidget window and
          # this can be adjusted based on placement preferences
          # Finally this is required if you want it displayed within your QWidget        
        def ButtonPushed(self):
            print('*** Oh my are you not a pushy one. ***')
    if __name__ == "__main__":
      # If you are not using Command Line objects then you do not need sys.argv
      # However if you are using Command Line objects you should look into 
      # argparser library as it handles them much cleaner and more intuitively
      # app = QApplication(sys.argv)
        MainEventHandler = QApplication([])
        application = Example()
      # This is the old PyQt4 method of calling this
      # sys.exit(app.exec_())
      # This is the current PyQt5 method of calling this
      # If anyone wants more extensive free help I run an online lab-like classroom-like 
      # message server feel free and drop by you will not be able to post until I clear 
      # you as a student as this prevents spammers so if interested here is the invite

Log in to reply