Home >Backend Development >Python Tutorial >Some QtGui structures

Some QtGui structures

Barbara Streisand
Barbara StreisandOriginal
2024-12-06 09:07:10379browse

Some QtGui structures

The GUI in Qt helps organize and synchronize a number of parameters:

  1. Kernel functions (Core) with their requirements for the installation environment and the order of implementation of variables
  2. Widgets in Qt are represented as memory-allocated code blocks, implemented in .py and described in XML in .ui
  3. The organization follows a principle similar to the connection between JavaScript, HTML and CSS
font = QtGui.QFont()
        font.setPointSize(10)
        self.pushButton.setFont(font)
        self.pushButton.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.pushButton.setObjectName("pushButton")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1126, 26))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)

After connecting the QtGui library, we can set the parameters and widgets we need on the graphical interface, while simultaneously naming them for the code.
Various classes, such as QPushButton, QMenuBar, QStatusBar, determine the coverage area of ​​a particular object. Various modules resemble API methods in structure, and when you call each one you get the expected call.

 <widget>



<p>Don’t forget to describe each of the listed classes in XML for the correct layout of files when launched. Gui provides only the output image; you write the entire backend in other Qt modules.<br>
It's better to store project files in one place, which will avoid explicitly writing their paths in the computer memory. If it's possible not to produce more files, write to everything in one. Python, unlike Java/C/Kotlin, doesn't allow structures that are difficult to compile.</p>


          

            
        

The above is the detailed content of Some QtGui structures. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn