я же вам написал Form = QWidget()
, а не Form = QtWidgets()
В общем ваше приложение может выглядеть так, закомментируйте мои импорты и раскомментируйте свои. Я отметил строки, в которые внес изменения.
'''
from PySide2.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject,
QObject, QPoint, QRect, QSize, QTime, QUrl, Qt)
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter,
QPixmap, QRadialGradient)
from PySide2.QtWidgets import QApplication, QWidget, QPushButton, QLabel
'''
from PyQt5.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject,
QObject, QPoint, QRect, QSize, QTime, QUrl, Qt)
from PyQt5.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter,
QPixmap, QRadialGradient)
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLabel
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(326, 206)
self.pushButton = QPushButton(Form)
self.pushButton.setObjectName(u"pushButton")
self.pushButton.setGeometry(QRect(130, 110, 75, 23))
self.label = QLabel(Form)
self.label.setObjectName(u"label")
self.label.setGeometry(QRect(80, 30, 381, 31))
self.label.setStyleSheet(u"font-size: 20px;")
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
Form.setWindowTitle(QApplication.translate("Form", u"Form", None))
self.pushButton.setText(QApplication.translate("Form", u"PushButton", None))
self.label.setText(QApplication.translate("Form", u"TextLabel", None))
if __name__ == "__main__":
import sys # +++
# app = QtGui.QCoreApplication(sys.argv) # ---
app = QApplication(sys.argv) # +++
# Form = QtGui.QtWidgets() # ---
Form = QWidget() # +++
# ui = Ui_widget() # ---
ui = Ui_Form() # +++
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_())

Но учитывая, что вы вероятно захотите оживить свое приложение и добавить какую-то логику, я вам предложу попробовать вариант как правильно это сделать.
'''
from PySide2.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject,
QObject, QPoint, QRect, QSize, QTime, QUrl, Qt)
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter,
QPixmap, QRadialGradient)
from PySide2.QtWidgets import QApplication, QWidget, QPushButton, QLabel
'''
from PyQt5.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject,
QObject, QPoint, QRect, QSize, QTime, QUrl, Qt)
from PyQt5.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter,
QPixmap, QRadialGradient)
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLabel
class Ui_Form(object):
def setupUi(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(326, 206)
self.pushButton = QPushButton(Form)
self.pushButton.setObjectName(u"pushButton")
self.pushButton.setGeometry(QRect(130, 110, 75, 23))
self.label = QLabel(Form)
self.label.setObjectName(u"label")
self.label.setGeometry(QRect(80, 30, 381, 31))
self.label.setStyleSheet(u"font-size: 20px;")
self.retranslateUi(Form)
QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
Form.setWindowTitle(QApplication.translate("Form", u"Form", None))
self.pushButton.setText(QApplication.translate("Form", u"PushButton", None))
self.label.setText(QApplication.translate("Form", u"TextLabel", None))
class Window(QWidget, Ui_Form):
def __init__(self):
super().__init__()
self.setupUi(self)
# тут пишем логику приложения
self.pushButton.clicked.connect(self.onClicked)
def onClicked(self):
print(f'Вы нажали кнопку `PushButton`')
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
window = Window()
window.show()
sys.exit(app.exec_())
Form = QtGui.QtWidgets()
наForm = QWidget()
QtGui
, его тоже нужно импортировать, т.е.from PySide2 import QtGui
, либо сразу делать импорт класса из прямого модуля, т.е.from PySide2.QtGui import
2) У вас уже есть импортQCoreApplication
, поэтому достаточноapp = QCoreApplication(sys.argv)
3) меня смущает, что вы используете виджеты (окна) при этом у вас приложениеQCoreApplication
, а неQApplication
(изQtWidgets
)from PySide2.QtWidgets import *
задавайте импорт буквальноForm = QtWidgets() TypeError: 'module' object is not callable
код:import sys
from PySide2 import QtGui, QtWidgets
from PySide2.QtWidgets import *
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *