Let’s Learn Python #24 – UI with Python, PyQt & Qt Designer

Python

Video is ready, Click Here to View ×


This week, I cover the basic creation of a User Interface with Qt Designer, PyQt and Python!

Please leave me a comment or question below! Like and Subscribe to show your support! 😀

========================================
LINK-A-SAURUS!!

Editor = SUBLIME TEXT 2: http://www.sublimetext.com/2

*** DOWNLOADS ***
Qt Creator/Designer: https://qt-project.org/downloads
PyQt: http://www.riverbankcomputing.com/software/pyqt/download

Qt Documentation:…

26 thoughts on “Let’s Learn Python #24 – UI with Python, PyQt & Qt Designer

  1. Really nice explanation and presentation!! I have just one doubt, if you wanna run the class with the window as one thread, how could you do it? what to write inside the definition of 'def run(self): ¿?'

  2. Hi! First of all, great video! It's very entertaining and clear! Now to my cry for help:
    I've been doing a UI using the method used on this video, but now I need to embed a custom widget to my UI (I need leds and an analog display in the sorts of: https://www.linux-apps.com/p/1132205/ ) . Ok, so I started with something simple, adding a custom led (https://www.linux-apps.com/p/1132197/) Up to now I think I've correctly installed the custom widget plugin because I can see the Qled widget on my QtCreator interface, I can add it to my UI, and I've even created a signal/slot connection to a button, and if I preview my UI, if I push the button, the led turns on. The problem is that after converting my .ui into .py with pyiuc5, if I ran my main.py I'm getting the following error:

    File"/home/pi/QT/PWaddBar/Powdesign.py", line 146, in <module>
    from qled import Qled ImportError: No module named 'qled'

    If I already did the button connection to my Qled on QtCreator, isn't supposed to work even though I'm coding on python3? Or what step could I be missing? Or how can I use those custom widgets if I'm coding on python3 ? Any suggestion would be greatly appreciated, and I hope you guys can have me patience since I'm kind of new to python and all this GUI stuff

  3. Hi T.Payne, great to watch your video. I tried to make a UI with python3 and PyQt5, and I want to connect a QAction in menu bar to a window when I clicked. Could you please help me to solve this problem?

  4. When I press F5, nothing happens. The Python shell restarts, but then stays silence.
    I applied this tutorial to the Qt designer on my Raspberry Pi. Despite some little code modifications for the conversion (in the terminal from Raspberry), I followed the exact same procedure. Do you know what could be the reason?

  5. Tried this in 2017 and it did to following to get it to work (64bit windows):
    – get Python 3.40 (64bit) and install it with the standard path. This is important due to PyQTs` reference to this folder
    https://www.python.org/downloads/release/python-340/
    – get PyQT in Version "PyQt5-5.5-gpl-Py3.4-Qt5.5.0-x64" installed
    https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.5/
    – Go to "C:Python34Libsite-packagesPyQt5" and open the QT Designer (designer.exe)
    – Create your GUI and save it to "C:Python34Libsite-packagesPyQt5uic"
    – Open Windows Commandline
    – type "cd C:Python34Libsite-packagesPyQt5uic"
    – type "pyuic5 -o Yourfile.py Yourfile.ui" with "Yourfile" exchanged with your QT Designer file name for sure

  6. DOWNLOAD FOR 2017:

    QT Designer is now bundled inside QT Creator which you can download here:
    https://www.qt.io/download-open-source/

    Then when you launch QT Creator select file -> New File/Project -> Under "Files and Classes" pick "QT" -> QT Designer Form -> Choose -> Widget -> Continue -> Done

    Then you are ready to go with Designer and can follow along with this video

  7. Hey Trevor, I know this is an older video, but the links for the Qt creator/designer have expired. Do you know where I can find a free, safe and legal download? Or a different but similar program? Thanks!

  8. I'm using PyQT5 and this is the command I used for a UI file named EDA.ui

    pyuic5.exe -x EDA.ui -o EDA.py

    I've got an odd directory so no clue if this helps but tl;dr I ran the command prompt here:
    D:UsersTravisAppDataLocalProgramsPythonPython36-32Scripts>
    ^ And in that folder was pyuic5.exe

    Also, my Qt Designer I just downloaded from the official website. Idk why others are getting theirs from Pyside or w/e the designer doesn't matter o.O

    Also, I use PyDev. Other IDEs may be better but this one's great for me – setting it up to work with Dark Mode was easy enough (don't install a theme just change the colors yourself! D: ) and the only thing I really had to change was disabling the spellcheck (With variable names like "Dict_Label" I'm getting annoying squiggles because I reference them in comments) imo I'd strongly recommend an IDE as a text editor lacks a lot of improvements like real-time syntax correction, ease of running the code, project management, ect. But that's up to you (:

  9. I was hoping to be able to use your guide to write some Qt/Python code, but installing Qt is proving to be a nightmare! It doesn't help that Qt itself appears to have moved its host website. I was able to find an older copy and install (Win7) Qt5.2.1, however the "designer" program was buried in a deep folder and not obvious to find. Then I tried to install QtPy4. Now I had problems with "nmake" missing, this was fixed, then c1 throwing a DLL error, fixed this, then running configure_ng.py (which appears to do a C compilation, so clearly you need MS Visual C installed – who would have guessed) the message Qt5core.dll is missing. I found this DLL under Qt5.2.1 (had to add the dir to the PATH), then an error with SIP (not solved). Does it really have to be so complicated???

Leave a Reply

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