It is often quite tedious to program user interfaces for software by hand. You have to define a lot of settings for the layout and in the end you have a mess of design and function in the code. Especially with complex graphical user interfaces (GUI), the code quickly gets out of hand and you can lose track of things.
With the Qt Designer you can create simple or complex layouts using drag-and-drop. The created layout can then be used for your Python program via the GUI toolkit PyQt. Appearance and logic are strictly separated: The design is outsourced in a separate UI file, the functions for it are created as usual in the Python file. Knowledge of PyQt helps, of course, but the designer is also well suited to learning basic concepts of PyQt and Qt.
We show how to build a simple login window. The window consists of a note, two labels for password and user name, two input fields and a button. The user should enter his data for heise online and after clicking the button receive a response as to whether the login worked. There should also be a small menu that the user can use to exit the program. For this example we use PyQt5 and Python 3.8 on Windows 10.
- Access to all heise + content
- exclusive tests, advice & background: independent, critically well-founded
- Read c’t, iX, MIT Technology Review, Mac & i, Make, c’t photography directly in your browser
- register once – read on all devices – can be canceled monthly
- first month free, then monthly from € 9.95
- Weekly newsletter with personal reading recommendations from the editor-in-chief
Start FREE month
Start your FREE month now
Already subscribed to heise +?
Sign up and read
Register now and read articles right away
More information about heise +
Disclaimer: This article is generated from the feed and not edited by our team.