DEV Community 👩‍💻👨‍💻

Cover image for GUI with Python
importostar
importostar

Posted on

GUI with Python

You can build a GUI or graphical interface with Python, it's not just all terminal.

Yes, you can make desktop apps with Python. This looks like any other app on your computer like

python pyqt

You can see more screenshots of things you can make here

So is it hard to make GUI apps with Python?

Well, you should first know the basics of Python. It has some learning curve but it's not rocket science.

Python GUI

Basically you have to install the PyQt module and load it. Then you can create a window and add all kinds of widgets to it.

For example, the "hello world" app looks like this (source: pyqt):

import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QHBoxLayout

if __name__ == '__main__':    
    app = QApplication(sys.argv)
    w = QWidget()    
    layout = QHBoxLayout()
    btn = QPushButton("Hello World!")
    layout.addWidget(btn)
    w.setLayout(layout)
    w.resize(250, 150)
    w.move(300, 300)
    w.setWindowTitle('Simple')
    w.show()
    sys.exit(app.exec_())

pyqt button

It adds a button, resizes window, sets a window title etc. PyQt has a widget for everything you can think of, so regardless of whether you want to make a web browser, an office suite or anything else you can.

If you are new to PyQt, then this is a good course

Top comments (0)

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠