Home >Backend Development >Python Tutorial >QtWidgets and QtCore

QtWidgets and QtCore

Patricia Arquette
Patricia ArquetteOriginal
2024-11-28 18:49:10623browse

QtWidgets and QtCore

Widgets in GitHub usually focus on making the contact/file quickly accessible upon import. Only in Qt are they equipped with the function of transporting data from Core to visual and .exe.

from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1126, 694)
        MainWindow.setStyleSheet("background-color: rgb(233, 255, 157);")
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(30, 30, 441, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(30, 100, 251, 21))

Unfortunately, it won't be possible to create this artificially, no matter how hard the AI ​​tries. Because the visual doesn't wander from the form to the operating system and it is better to write functions explicitly.

<widget>



<p>In addition to setting the optimal options, there are a number of features:</p>

  • It is better to separate Gui and Widgets into a separate block, because... features do not affect performance
  • As for connecting to the database/identifiers/libraries, write in every line of code, referencing like this: QtCore.QMetaObject.connectSlotsByName(MainWindow)
  • Ask the file storage to use already implemented MainWindow functions, because it saves time

The above is the detailed content of QtWidgets and QtCore. 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