Create Python GUI Application using PyQt5 Designer with Python 3.6.3



PyQt is a Python binding of the cross-platform GUI toolkit Qt, implemented as a Python plug-in. It helps app developers to use Python to design their own Application GUI.

Subscribe to Our Channel :
———————————————
Please Like, Comment, Share our Videos
———————————————————
Facebook Page:
YouTube:…

50 thoughts on “Create Python GUI Application using PyQt5 Designer with Python 3.6.3

  1. Does anyone now get:
    AttributeError: 'Life2Coding' object has no attribute 'on_pushButton_clicked'

    My Code:
    import sys

    from PyQt5.QtCore import pyqtSlot

    from PyQt5.QtWidgets import QApplication,QDialog,QMainWindow

    from PyQt5.uic import loadUi

    class Life2Coding(QDialog):

    def __init__(self):

    super(Life2Coding,self).__init__()

    loadUi('Life2Coding.ui',self)

    self.setWindowTitle('PyQt5 GUI')

    self.pushButton.clicked.connect(self.on_pushButton_clicked)

    @pyqtSlot()

    def on_pushButton_Clicked(self):

    self.label1.setText('Welcome: '+self.lineEdit.text())

    app=QApplication(sys.argv)

    widget=Life2Coding()

    widget.show()

    sys.exit(app.exec_())

  2. Dear Sir I watch your demo and i did exactly the same thing as you but when i run i get this error :line 12, in _init_
    self.pushButton.Clicked.connect(self.on_pushButton_clicked)
    AttributeError: 'QPushButton' object has no attribute 'Clicked'
    Please help me

  3. Hi, where do you code your python? is it in QT also? im lost. I already created my UI in QT. But do not know the next step towards back-end coding (functionality) using python. thank you for the help!

  4. I've been doing this the LONG way for quite some time… writing code, putting in functions, then changing the GUI and copy/paste the linking functions. This is big for me, thanks!

  5. I designed a gui like more than 2 years ago and had to wait this long to finally someone do a short and clear guide how to use the already generated gui file. Well done and greatly appreciate your effort for doing this video!

  6. Hi friend, i don't speak english so good but i think that u will be understand me,
    I did this code:
    import sys
    from PyQt5.QtCore import pyqtSlot
    from PyQt5.QtWidgets import QApplication,QDialog
    from PyQt5.uic import loadUi

    class Life2Coding(QDialog):
    def _init_(self):
    super(Life2Coding,self)._init_()
    loadUi('add.ui',self)
    self.setWindowTitle('Ventana Principal')
    self.pushButton.clicked.connect(self.on_pushButton_clicked)
    @pyqtSlot()
    def on_pushButton_clicked (self):
    self.label1.setText('Wlecome: '+ self.lineEdit.text())
    app=QApplication(sys.argv)
    widget=Life2Coding()
    widget.show()
    sys.exit(app.exec_())

    but this code no charge the "add.ui" only show a windows with the name pythonw (Using the last python version and pyQt5)

  7. My GUI freezes when I do this in my __init__.py file in the folder KironOS:

    from PyQt5.QtCore import pyqtSlot
    from PyQt5.QtWidgets import QApplication, QDialog
    from PyQt5.uic import loadUi

    def TryLogin(username,password):
    print(username)
    print(password)

    class Login(QDialog):
    def __init__(self):
    super(Login,self).__init__()
    loadUi("KironOS/login/login.ui",self)
    self.setWindowTitle("KironOS 1024 – Login")
    self.pushButton.clicked.connect(self.on_pushButton_clicked)
    @pyqtSlot()
    def on_pushButton_clicked(self):
    username = self.lineEdit.text()
    password = self.lineEdit_2.text()
    #username = "1"
    #password = "2"
    TryLogin(username,password)

    and this is my boot.py file:

    import sys
    from PyQt5.QtWidgets import QApplication
    from KironOS import *

    app = QApplication(sys.argv)
    LoginGUI = Login()
    LoginGUI.show()
    sys.exit(app.exec_())

  8. #!/usr/bin/python3.5
    # –– coding: utf-8 –
    import sys
    from PyQt5.QtCore import pyqtSlot
    from PyQt5.QtWidgets import QApplication, QDialog
    from PyQt5.uic import loadUi

    class DemoImpl(QDialog):
    def __init__(self, *args):
    super(DemoImpl, self).__init__(*args)
    loadUi('demo.ui', self)
    self.pushButton.clicked.connect(self.on_button1_clicked) #Название кнопки pushButton
    @pyqtSlot()
    def on_button1_clicked(self):
    self.label1.setText('Привет: '+self.lineEdit.text()) #Текст из поля lineEdit отображается в label1

    app = QApplication(sys.argv)
    widget = DemoImpl()
    widget.show()
    sys.exit(app.exec_())

  9. I am using this approach to learn python and how to use Qt Designer but discovered a major problem:

    def __init__(self):
    super…
    loadui…
    self.bttn_Increment.clicked.connect(self.on_bttn_Increment_clicked)

    @pyqtSlot()
    def on_bttn_Increment_clicked(self):

    index = int(self.lineEdit_Index.text())
    index = index + 1

    self.lineEdit_Index.setText(str(index))

    The code increments index by two. Removing “@pyqtSlot()” increments index by three!

    Obviously, there is a simple patch for this particular example but this approach is no good if I want to perform complex calculations.

    Is there a way to execute button code only once and still keep things very simple? Thanks.

  10. um…OMG thank you!!! The whole "Try to use QDialog. Or You need to modify the Header properly to use QMainWindow" stumped me for a minute but once I changed that in the class bla(HERE) bit I was in business. Much appreciated.

  11. I went through hell because your code didnt work for me — ultimately I used the following code with 3.5 python and pyqt5.6: (this just makes it so you can load your interface has no other functionality)

    from PyQt5 import uic, QtWidgets
    import sys

    class Ui(QtWidgets.QDialog):
    def __init__(self):
    super(Ui, self).__init__()
    uic.loadUi('untitled1.ui', self)
    self.show()

    if _name_ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    window = Ui()
    sys.exit(app.exec_())

Leave a Reply to Knowhow Cancel reply

Your email address will not be published. Required fields are marked *