0% found this document useful (0 votes)
4 views3 pages

Pyqt5 With Creator

The document explains how to use Qt Designer, a GUI builder tool included with the PyQt installer, to create a graphical user interface through a drag-and-drop method. It details the process of saving the design as a demo.ui file, which is then converted into a Python script using the pyuic4 command. The resulting Python script can display a dialog box, but it does not handle events like button clicks without additional coding.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Pyqt5 With Creator

The document explains how to use Qt Designer, a GUI builder tool included with the PyQt installer, to create a graphical user interface through a drag-and-drop method. It details the process of saving the design as a demo.ui file, which is then converted into a Python script using the pyuic4 command. The resulting Python script can display a dialog box, but it does not handle events like button clicks without additional coding.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

PyQt - Using Qt Designer

Advertisements

Previous Page
Next Page

The PyQt installer comes with a GUI builder tool called Qt Designer. Using its simple drag and
drop interface, a GUI interface can be quickly built without having to write the code. It is
however, not an IDE such as Visual Studio. Hence, Qt Designer does not have the facility to
debug and build the application.

Creation of a GUI interface using Qt Designer starts with choosing a top level window for the
application.

You can then drag and drop required widgets from the widget box on the left pane. You can
also assign value to properties of widget laid on the form.
The designed form is saved as demo.ui. This ui file contains XML representation of widgets and
their properties in the design. This design is translated into Python equivalent by using pyuic4
command line utility. This utility is a wrapper for uic module. The usage of pyuic4 is as follows

pyuic4 –x demo.ui –o demo.py

In the above command, -x switch adds a small amount of additional code to the generated XML
so that it becomes a self-executable standalone application.

if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
Dialog = QtGui.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
Dialog.show()
sys.exit(app.exec_())
The resultant python script is executed to show the following dialog box −

The user can input data in input fields but clicking on Add button will not generate any action as
it is not associated with any function. Reacting to user-generated response is called as event
handling.

You might also like