The following will display the Login dialog box by importing the loginForm.py file created using the pyuic5 command.
setText (_translate ( "Logindialog", "Cancel" ) ) setText (_translate ( "Logindialog", "Login" ) ) setText (_translate ( "Logindialog", "Password" ) ) setText (_translate ( "Logindialog", "Username" ) ) setText (_translate ( "Logindialog", "Login Form" ) ) setWindowTitle (_translate ( "Logindialog", "Dialog" ) ) connectSlotsByName (Logindialog )ĭef retranslateUi ( self, Logindialog ): # WARNING! All changes made in this file will be lost!įrom PyQt5 import QtCore, QtGui, QtWidgets
# Created by: PyQt5 UI code generator 5.12.3 # Form implementation generated from reading ui file 'Login.ui' Next, the exec() method is called to start the event loop of the application. The object of the application is created using the QApplication(), and the Qt Designer file is loaded using the loadUI() method. The necessary modules are imported at the beginning of the script.
The following script shows how to load the Qt Designer file named Login.ui that we created before. The UIC module of the PyQt library is used to load the file created by the Qt Designer, and the loadUI() method of the UIC module is used to load the UI file. Both ways of using the dialog box of Qt Designer are shown in the following section of the tutorial. The file can be used directly in the Python script, or the converted Python file of the Qt Designer file can be used in the Python script. The user interface file created by the Qt Designer can be used in the Python script in two ways. The QObject name will be changed to Logindialog using the Property Editor Window of this application. The dialog box will be saved with the name Login.ui, which will be used later in the Python script. Next, we will design a login form using the Label, Text Edit, and Push Button widgets. To begin designing the interface for the Python application, we will click the Create button in the following window to open the dialog box with two default buttons. The windows shown on the right side of the main window provides information about the widgets that can be read or modified.Ĭreate the First Form Using the Qt Designer The New Form window is used to create a new window using the default buttons. The Widget box shown on the left side of the main window contains various widgets that you can use to design the user interface of the application. If the Qt Designer has been installed properly, the following window will appear.