Is PYQT hard to use for Python beginners?
Tags: pyqt
Published: 2020-05-20 17:41:22

No, it's quite user-friendly after you learned the <a href="https://pythonbasics.org/">Python basics</a>. PyQt is a GUI module for Python.

There is lots of material to learn Pyqt, like <a href="https://gumroad.com/l/pysqtsamples">this book</a> or <a href="https://pythonpyqt.com/">howto</a>.

Unlike other GUI modules, PyQt comes with a <a href="https://pythonbasics.org/qt-designer-python/">designer</a> program that lets you drag and drop your GUI elements on your window. You can then export it as .ui file and load it in Python.

![pyqt designer](https://dev-to-uploads.s3.amazonaws.com/i/fu95gbkzi0oltrp9yhln.jpg)

So once you know the basics of Python, it's very easy to learn because there is a lot of training material and even a GUI designer. This makes it very easy to create desktop applications with Python. 

In fact, there are many many tutorials for PyQt. Here is a short list of tutorials for creating a GUI with PyQt:

* <a href="https://pythonbasics.org/#PyQt">PyQt articles</a>
* <a href="https://pythonspot.com/pyqt5/">PyQt tutorials</a>
* <a href="https://pythonpyqt.com/">Brief howto</a>
* <a href="https://pythonprogramminglanguage.com/pyqt/">More PyQt lessons</a>

This is what the "hello world" app looks like with PyQt. If you know Python and objects/classes it's straight forward, but without knowing it can be hard to grasp.

```python
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout                                                                
from PyQt5.QtCore import Qt                                                                                                                
                                                                                                                                           
class Window(QWidget):                                                                                                                     
    def __init__(self):                                                                                                                    
        QWidget.__init__(self)                                                                                                             
        self.button = QPushButton('Hello World', self)                                                                                     
        self.button.clicked.connect(self.handleButton)                                                                                     
        layout = QVBoxLayout(self)                                                                                                         
        layout.addWidget(self.button)                                                                                                      
                                                                                                                                           
    def handleButton(self):                                                                                                                
        print ('Hello World')                                                                                                              
                                                                                                                                           
if __name__ == '__main__':                                                                                                                 
    import sys                                                                                                                             
    app = QApplication(sys.argv)                                                                                                           
    window = Window()                                                                                                                      
    window.show()                                                                                                                          
    sys.exit(app.exec_())  
```