'MainWindow'对象没有属性'addWidget'



我试图创建一个应用程序,我使用QStakedWidget来创建页面,在主选项卡中我留下了一些按钮作为快捷方式,但是我试图将按钮连接到我的主代码,但它返回一个错误,说参数内没有addWidget的功能。我正在转换代码直接从Qt到python我怎么能修好它呢?

下面是代码,如果有人想看一下:

这是qt designer生成的代码。

# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'untitledCujXik.ui'
##
## Created by: Qt User Interface Compiler version 6.1.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
import icons_rc
class Ui_application_pages(object):
def setupUi(self, application_pages):
if not application_pages.objectName():
application_pages.setObjectName(u"application_pages")
application_pages.resize(1011, 716)
application_pages.setMaximumSize(QSize(16777215, 1080))
application_pages.setLayoutDirection(Qt.LeftToRight)
self.nfe = QWidget()
self.nfe.setObjectName(u"nfe")
self.verticalLayout_3 = QVBoxLayout(self.nfe)
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
self.MainWindow = QStackedWidget(self.nfe)
self.MainWindow.setObjectName(u"MainWindow")
self.MainWindowPage1 = QWidget()
self.MainWindowPage1.setObjectName(u"MainWindowPage1")
self.gridLayout = QGridLayout(self.MainWindowPage1)
self.gridLayout.setObjectName(u"gridLayout")
self.frame_8 = QFrame(self.MainWindowPage1)
self.frame_8.setObjectName(u"frame_8")
self.frame_8.setFrameShape(QFrame.StyledPanel)
self.frame_8.setFrameShadow(QFrame.Raised)
self.gridLayout.addWidget(self.frame_8, 1, 0, 1, 1)
self.frame_7 = QFrame(self.MainWindowPage1)
self.frame_7.setObjectName(u"frame_7")
self.frame_7.setFrameShape(QFrame.StyledPanel)
self.frame_7.setFrameShadow(QFrame.Raised)
self.gridLayout.addWidget(self.frame_7, 2, 6, 1, 1)
self.frame_13 = QFrame(self.MainWindowPage1)
self.frame_13.setObjectName(u"frame_13")
self.frame_13.setFrameShape(QFrame.StyledPanel)
self.frame_13.setFrameShadow(QFrame.Raised)
self.gridLayout.addWidget(self.frame_13, 1, 2, 1, 1)
self.frame_6 = QFrame(self.MainWindowPage1)
self.frame_6.setObjectName(u"frame_6")
self.frame_6.setFrameShape(QFrame.StyledPanel)
self.frame_6.setFrameShadow(QFrame.Raised)
self.gridLayout.addWidget(self.frame_6, 2, 0, 1, 1)
self.frame_2 = QFrame(self.MainWindowPage1)
self.frame_2.setObjectName(u"frame_2")
self.frame_2.setMinimumSize(QSize(0, 40))
self.frame_2.setFrameShape(QFrame.StyledPanel)
self.frame_2.setFrameShadow(QFrame.Raised)
self.gridLayout.addWidget(self.frame_2, 4, 3, 1, 1)
self.frame_5 = QFrame(self.MainWindowPage1)
self.frame_5.setObjectName(u"frame_5")
self.frame_5.setMinimumSize(QSize(0, 20))
self.frame_5.setFrameShape(QFrame.StyledPanel)
self.frame_5.setFrameShadow(QFrame.Raised)
self.gridLayout.addWidget(self.frame_5, 2, 3, 1, 1)
self.frame_9 = QFrame(self.MainWindowPage1)
self.frame_9.setObjectName(u"frame_9")
self.frame_9.setFrameShape(QFrame.StyledPanel)
self.frame_9.setFrameShadow(QFrame.Raised)
self.gridLayout.addWidget(self.frame_9, 1, 5, 1, 1)
self.frame_11 = QFrame(self.MainWindowPage1)
self.frame_11.setObjectName(u"frame_11")
self.frame_11.setFrameShape(QFrame.StyledPanel)
self.frame_11.setFrameShadow(QFrame.Raised)
self.gridLayout.addWidget(self.frame_11, 1, 4, 1, 1)
self.frame_10 = QFrame(self.MainWindowPage1)
self.frame_10.setObjectName(u"frame_10")
self.frame_10.setFrameShape(QFrame.StyledPanel)
self.frame_10.setFrameShadow(QFrame.Raised)
self.gridLayout.addWidget(self.frame_10, 1, 6, 1, 1)
self.frame = QFrame(self.MainWindowPage1)
self.frame.setObjectName(u"frame")
self.frame.setStyleSheet(u"QFrame{n"
"   background-color: rgb(249, 249, 249);n"
"   padding: 8px;n"
"   border: 1px solid #D3D3D3;n"
"   color: rgb(0, 0, 0);n"
"   border-radius: 10px;    n"
"}")
self.frame.setFrameShape(QFrame.StyledPanel)
self.frame.setFrameShadow(QFrame.Sunken)
self.gridLayout_2 = QGridLayout(self.frame)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.toolButton_8 = QToolButton(self.frame)
self.toolButton_8.setObjectName(u"toolButton_8")
self.toolButton_8.setStyleSheet(u"QToolButton{n"
"   border: 0pxn"
"}")
icon = QIcon()
icon.addFile(u":/G_AREA/icones/graficos/g_area.png", QSize(), QIcon.Normal, QIcon.Off)
self.toolButton_8.setIcon(icon)
self.toolButton_8.setIconSize(QSize(66, 66))
self.gridLayout_2.addWidget(self.toolButton_8, 6, 4, 1, 1)
self.verticalSpacer_3 = QSpacerItem(20, 20, QSizePolicy.Minimum, QSizePolicy.Fixed)
self.gridLayout_2.addItem(self.verticalSpacer_3, 1, 1, 1, 1)
self.label_10 = QLabel(self.frame)
self.label_10.setObjectName(u"label_10")
self.label_10.setMaximumSize(QSize(66, 30))
self.label_10.setStyleSheet(u"QLabel{n"
"   border: 0px;n"
"}")
self.label_10.setAlignment(Qt.AlignCenter)
self.gridLayout_2.addWidget(self.label_10, 7, 1, 1, 1)
self.label_11 = QLabel(self.frame)
self.label_11.setObjectName(u"label_11")
self.label_11.setMaximumSize(QSize(66, 30))
self.label_11.setStyleSheet(u"QLabel{n"
"   border: 0px;n"
"}")
self.label_11.setAlignment(Qt.AlignCenter)
self.gridLayout_2.addWidget(self.label_11, 7, 2, 1, 1)
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.gridLayout_2.addItem(self.horizontalSpacer, 0, 1, 1, 1)
self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.gridLayout_2.addItem(self.verticalSpacer, 8, 1, 1, 1)
self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.gridLayout_2.addItem(self.horizontalSpacer_2, 0, 2, 1, 1)
self.label_12 = QLabel(self.frame)
self.label_12.setObjectName(u"label_12")
self.label_12.setMaximumSize(QSize(66, 30))
self.label_12.setStyleSheet(u"QLabel{n"
"   border: 0px;n"
"}")
self.label_12.setAlignment(Qt.AlignCenter)
self.gridLayout_2.addWidget(self.label_12, 7, 3, 1, 1)
self.NFCEHOME = QToolButton(self.frame)
self.NFCEHOME.setObjectName(u"NFCEHOME")
self.NFCEHOME.setStyleSheet(u"QToolButton{n"
"   border: 0pxn"
"}")
icon1 = QIcon()
iconThemeName = u"NFCE_ICON"
if QIcon.hasThemeIcon(iconThemeName):
icon1 = QIcon.fromTheme(iconThemeName)
else:
icon1.addFile(u":/NFCE/icones/NF/NFCE.png", QSize(), QIcon.Normal, QIcon.Off)

self.NFCEHOME.setIcon(icon1)
self.NFCEHOME.setIconSize(QSize(66, 66))
self.gridLayout_2.addWidget(self.NFCEHOME, 3, 2, 1, 1)
self.label_9 = QLabel(self.frame)
self.label_9.setObjectName(u"label_9")
self.label_9.setMaximumSize(QSize(66, 25))
self.label_9.setStyleSheet(u"QLabel{n"
"   border: 0px;n"
"}")
self.label_9.setAlignment(Qt.AlignCenter)
self.gridLayout_2.addWidget(self.label_9, 4, 4, 1, 1)
self.horizontalSpacer_3 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.gridLayout_2.addItem(self.horizontalSpacer_3, 0, 3, 1, 1)
self.NFEHOME = QToolButton(self.frame)
self.NFEHOME.setObjectName(u"NFEHOME")
self.NFEHOME.setStyleSheet(u"QToolButton{n"
"   border: 0pxn"
"}")
self.NFEHOME.setText(u"")
icon2 = QIcon()
icon2.addFile(u":/NFE/icones/NF/NFE.png", QSize(), QIcon.Normal, QIcon.Off)
self.NFEHOME.setIcon(icon2)
self.NFEHOME.setIconSize(QSize(66, 66))
self.gridLayout_2.addWidget(self.NFEHOME, 3, 1, 1, 1)
self.NFSE = QToolButton(self.frame)
self.NFSE.setObjectName(u"NFSE")
self.NFSE.setStyleSheet(u"QToolButton{n"
"   border: 0pxn"
"}")
icon3 = QIcon()
icon3.addFile(u":/NFSE/icones/NF/NFSE.png", QSize(), QIcon.Normal, QIcon.Off)
self.NFSE.setIcon(icon3)
self.NFSE.setIconSize(QSize(66, 66))
self.gridLayout_2.addWidget(self.NFSE, 3, 4, 1, 1)
self.label_8 = QLabel(self.frame)
self.label_8.setObjectName(u"label_8")
self.label_8.setMaximumSize(QSize(66, 25))
self.label_8.setStyleSheet(u"QLabel{n"
"   border: 0px;n"
"}")
self.label_8.setAlignment(Qt.AlignCenter)
self.gridLayout_2.addWidget(self.label_8, 4, 3, 1, 1)
self.horizontalSpacer_4 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.gridLayout_2.addItem(self.horizontalSpacer_4, 0, 4, 1, 1)
self.verticalSpacer_2 = QSpacerItem(20, 50, QSizePolicy.Minimum, QSizePolicy.Fixed)
self.gridLayout_2.addItem(self.verticalSpacer_2, 5, 1, 1, 1)
self.label_7 = QLabel(self.frame)
self.label_7.setObjectName(u"label_7")
self.label_7.setMaximumSize(QSize(66, 25))
self.label_7.setStyleSheet(u"QLabel{n"
"   border: 0px;n"
"}")
self.label_7.setAlignment(Qt.AlignCenter)
self.gridLayout_2.addWidget(self.label_7, 4, 2, 1, 1)
self.toolButton_6 = QToolButton(self.frame)
self.toolButton_6.setObjectName(u"toolButton_6")
self.toolButton_6.setStyleSheet(u"QToolButton{n"
"   border: 0pxn"
"}")
icon4 = QIcon()
icon4.addFile(u":/G_ROSCA/icones/graficos/g_rosca.png", QSize(), QIcon.Normal, QIcon.Off)
self.toolButton_6.setIcon(icon4)
self.toolButton_6.setIconSize(QSize(66, 66))
self.gridLayout_2.addWidget(self.toolButton_6, 6, 2, 1, 1)
self.toolButton_7 = QToolButton(self.frame)
self.toolButton_7.setObjectName(u"toolButton_7")
self.toolButton_7.setStyleSheet(u"QToolButton{n"
"   border: 0pxn"
"}")
icon5 = QIcon()
icon5.addFile(u":/G_PIZZA/icones/graficos/g_pizza.png", QSize(), QIcon.Normal, QIcon.Off)
self.toolButton_7.setIcon(icon5)
self.toolButton_7.setIconSize(QSize(66, 66))
self.gridLayout_2.addWidget(self.toolButton_7, 6, 3, 1, 1)
self.toolButton_5 = QToolButton(self.frame)
self.toolButton_5.setObjectName(u"toolButton_5")
self.toolButton_5.setStyleSheet(u"QToolButton{n"
"   border: 0pxn"
"}")
icon6 = QIcon()
icon6.addFile(u":/G_BARRAS/icones/graficos/g_barra.png", QSize(), QIcon.Normal, QIcon.Off)
self.toolButton_5.setIcon(icon6)
self.toolButton_5.setIconSize(QSize(66, 66))
self.gridLayout_2.addWidget(self.toolButton_5, 6, 1, 1, 1)
self.label_6 = QLabel(self.frame)
self.label_6.setObjectName(u"label_6")
self.label_6.setMinimumSize(QSize(50, 0))
self.label_6.setMaximumSize(QSize(66, 25))
font = QFont()
font.setPointSize(9)
font.setBold(False)
font.setUnderline(False)
font.setStrikeOut(False)
font.setKerning(True)
font.setStyleStrategy(QFont.PreferDefault)
self.label_6.setFont(font)
self.label_6.setMouseTracking(False)
self.label_6.setFocusPolicy(Qt.NoFocus)
self.label_6.setLayoutDirection(Qt.LeftToRight)
self.label_6.setStyleSheet(u"QLabel{n"
"   border: 0px;n"
"}")
self.label_6.setTextFormat(Qt.AutoText)
self.label_6.setAlignment(Qt.AlignCenter)
self.gridLayout_2.addWidget(self.label_6, 4, 1, 1, 1)
self.label_5 = QLabel(self.frame)
self.label_5.setObjectName(u"label_5")
self.label_5.setStyleSheet(u"QLabel{n"
"   color: #A4A4A4; n"
"   border: 0px;n"
"}")
self.gridLayout_2.addWidget(self.label_5, 0, 0, 1, 1)
self.label_13 = QLabel(self.frame)
self.label_13.setObjectName(u"label_13")
self.label_13.setMaximumSize(QSize(66, 30))
self.label_13.setStyleSheet(u"QLabel{n"
"   border: 0px;n"
"}")
self.label_13.setAlignment(Qt.AlignCenter)
self.gridLayout_2.addWidget(self.label_13, 7, 4, 1, 1)
self.CTEHOME = QToolButton(self.frame)
self.CTEHOME.setObjectName(u"CTEHOME")
self.CTEHOME.setStyleSheet(u"QToolButton{n"
"   border: 0pxn"
"}")
icon7 = QIcon()
icon7.addFile(u":/CTE/icones/NF/CTE.png", QSize(), QIcon.Normal, QIcon.Off)
self.CTEHOME.setIcon(icon7)
self.CTEHOME.setIconSize(QSize(66, 66))
self.gridLayout_2.addWidget(self.CTEHOME, 3, 3, 1, 1)
self.label_14 = QLabel(self.frame)
self.label_14.setObjectName(u"label_14")
self.label_14.setStyleSheet(u"QLabel{n"
"   color: #A4A4A4; n"
"   border: 0px;n"
"}")
self.gridLayout_2.addWidget(self.label_14, 5, 0, 1, 1)

self.gridLayout.addWidget(self.frame, 3, 2, 1, 3)
self.frame_12 = QFrame(self.MainWindowPage1)
self.frame_12.setObjectName(u"frame_12")
self.frame_12.setFrameShape(QFrame.StyledPanel)
self.frame_12.setFrameShadow(QFrame.Raised)
self.gridLayout.addWidget(self.frame_12, 1, 1, 1, 1)
self.frame_14 = QFrame(self.MainWindowPage1)
self.frame_14.setObjectName(u"frame_14")
self.frame_14.setMinimumSize(QSize(600, 45))
self.frame_14.setFrameShape(QFrame.StyledPanel)
self.frame_14.setFrameShadow(QFrame.Raised)
self.lineEdit = QLineEdit(self.frame_14)
self.lineEdit.setObjectName(u"lineEdit")
self.lineEdit.setGeometry(QRect(0, 0, 595, 40))
self.lineEdit.setMinimumSize(QSize(595, 40))
self.lineEdit.setStyleSheet(u"QLineEdit{n"
"   background-color: rgb(249, 249, 249);n"
"   padding: 8px;n"
"   border: 1px solid #D3D3D3;n"
"   color:  #A4A4A4;n"
"   border-radius: 10px;    n"
"}n"
"")
self.lineEdit.setAlignment(Qt.AlignCenter)
self.toolButton_9 = QToolButton(self.frame_14)
self.toolButton_9.setObjectName(u"toolButton_9")
self.toolButton_9.setGeometry(QRect(560, 10, 22, 22))
self.toolButton_9.setStyleSheet(u"QToolButton{n"
"   border: 0px;n"
"}")
icon8 = QIcon()
iconThemeName = u"Lupa"
if QIcon.hasThemeIcon(iconThemeName):
icon8 = QIcon.fromTheme(iconThemeName)
else:
icon8.addFile(u":/LUPA/icones/utilitu00e1rios/lupa.png", QSize(), QIcon.Normal, QIcon.Off)

self.toolButton_9.setIcon(icon8)
self.toolButton_9.setIconSize(QSize(20, 30))
self.gridLayout.addWidget(self.frame_14, 1, 3, 1, 1)
self.MainWindow.addWidget(self.MainWindowPage1)
self.verticalLayout_3.addWidget(self.MainWindow)
application_pages.addWidget(self.nfe)
self.relatorios = QWidget()
self.relatorios.setObjectName(u"relatorios")
self.verticalLayout_6 = QVBoxLayout(self.relatorios)
self.verticalLayout_6.setObjectName(u"verticalLayout_6")
self.frame_3 = QFrame(self.relatorios)
self.frame_3.setObjectName(u"frame_3")
self.frame_3.setFrameShape(QFrame.StyledPanel)
self.frame_3.setFrameShadow(QFrame.Raised)
self.verticalLayout_4 = QVBoxLayout(self.frame_3)
self.verticalLayout_4.setObjectName(u"verticalLayout_4")
self.label_3 = QLabel(self.frame_3)
self.label_3.setObjectName(u"label_3")
self.label_3.setAlignment(Qt.AlignCenter)
self.verticalLayout_4.addWidget(self.label_3)

self.verticalLayout_6.addWidget(self.frame_3)
application_pages.addWidget(self.relatorios)
self.controle = QWidget()
self.controle.setObjectName(u"controle")
self.verticalLayout_2 = QVBoxLayout(self.controle)
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
self.label_2 = QLabel(self.controle)
self.label_2.setObjectName(u"label_2")
self.label_2.setAlignment(Qt.AlignCenter)
self.verticalLayout_2.addWidget(self.label_2)
application_pages.addWidget(self.controle)
self.financeiro = QWidget()
self.financeiro.setObjectName(u"financeiro")
self.verticalLayout = QVBoxLayout(self.financeiro)
self.verticalLayout.setObjectName(u"verticalLayout")
self.label = QLabel(self.financeiro)
self.label.setObjectName(u"label")
self.label.setAlignment(Qt.AlignCenter)
self.verticalLayout.addWidget(self.label)
application_pages.addWidget(self.financeiro)
self.configuracoes = QWidget()
self.configuracoes.setObjectName(u"configuracoes")
self.verticalLayout_8 = QVBoxLayout(self.configuracoes)
self.verticalLayout_8.setObjectName(u"verticalLayout_8")
self.frame_4 = QFrame(self.configuracoes)
self.frame_4.setObjectName(u"frame_4")
self.frame_4.setFrameShape(QFrame.StyledPanel)
self.frame_4.setFrameShadow(QFrame.Raised)
self.verticalLayout_5 = QVBoxLayout(self.frame_4)
self.verticalLayout_5.setObjectName(u"verticalLayout_5")
self.label_4 = QLabel(self.frame_4)
self.label_4.setObjectName(u"label_4")
self.label_4.setAlignment(Qt.AlignCenter)
self.verticalLayout_5.addWidget(self.label_4)

self.verticalLayout_8.addWidget(self.frame_4)
application_pages.addWidget(self.configuracoes)
self.retranslateUi(application_pages)
QMetaObject.connectSlotsByName(application_pages)
# setupUi
def retranslateUi(self, application_pages):
application_pages.setWindowTitle(QCoreApplication.translate("application_pages", u"StackedWidget", None))
self.toolButton_8.setText(QCoreApplication.translate("application_pages", u"...", None))
self.label_10.setText(QCoreApplication.translate("application_pages", u"Barras", None))
self.label_11.setText(QCoreApplication.translate("application_pages", u"Rosca", None))
self.label_12.setText(QCoreApplication.translate("application_pages", u"Pizza", None))
self.NFCEHOME.setText(QCoreApplication.translate("application_pages", u"...", None))
self.label_9.setText(QCoreApplication.translate("application_pages", u"NFSE", None))
self.NFSE.setText(QCoreApplication.translate("application_pages", u"...", None))
self.label_8.setText(QCoreApplication.translate("application_pages", u"CTE", None))
self.label_7.setText(QCoreApplication.translate("application_pages", u"NFCE", None))
self.toolButton_6.setText(QCoreApplication.translate("application_pages", u"...", None))
self.toolButton_7.setText(QCoreApplication.translate("application_pages", u"...", None))
self.toolButton_5.setText(QCoreApplication.translate("application_pages", u"...", None))
self.label_6.setText(QCoreApplication.translate("application_pages", u"NFE", None))
self.label_5.setText(QCoreApplication.translate("application_pages", u"Acessar", None))
self.label_13.setText(QCoreApplication.translate("application_pages", u"u00c1rea", None))
self.CTEHOME.setText(QCoreApplication.translate("application_pages", u"...", None))
self.label_14.setText(QCoreApplication.translate("application_pages", u"Gerar Gru00e1fico", None))
self.lineEdit.setText(QCoreApplication.translate("application_pages", u"Digite aqui", None))
self.toolButton_9.setText(QCoreApplication.translate("application_pages", u"...", None))
self.label_3.setText(QCoreApplication.translate("application_pages", u"relatu00f3rios", None))
self.label_2.setText(QCoreApplication.translate("application_pages", u"controle", None))
self.label.setText(QCoreApplication.translate("application_pages", u"Financeiro", None))
self.label_4.setText(QCoreApplication.translate("application_pages", u"configuracoes", None))
# retranslateUi
[enter image description here][1]

和脚本main

import sys
import os 
# Import Qt_Core
from qt_core import *

#import Main_window
from Windows.main_win.ui_main_window import Ui_MainWindow
from pages.ui_pages import *

# Main Window
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle('Ravi - Monitor')
#Setup Main Window
self.ui = Ui_MainWindow()
self.ui.setup_ui(self)
#Set Application Pages
self.ui_pages = Ui_application_pages()
self.ui_pages.setupUi(self)
#Toger Button
self.ui.toggle_button.clicked.connect(self.toggle_button)
#Btn Notas
self.ui.btn_nfe.clicked.connect(self.show_nfe)
#Btn Relatórios
self.ui.btn_relatorios.clicked.connect(self.show_relatorios)
#Btn Financeiro
self.ui.btn_financeiro.clicked.connect(self.show_financeiro)
#Btn Controle
self.ui.btn_controle_nfe.clicked.connect(self.show_controle)
#Btn configurações
self.ui.setting_button.clicked.connect(self.show_configuracoes)
#BTN HOME
self.ui_pages.NFEHOME.clicked.connect(self.show_financeiro)

#Exibe a aplicação
self.show()
def reset_selection(self):
for btn in self.ui.left_menu.findChildren(QPushButton):
try:
btn.set_active(False)
except:
pass
def show_nfe(self):
self.reset_selection()
self.ui.pages.setCurrentWidget(self.ui.ui_pages.nfe)
self.ui.btn_nfe.set_active(True)
def show_relatorios(self):
self.reset_selection()
self.ui.pages.setCurrentWidget(self.ui.ui_pages.relatorios)
self.ui.btn_relatorios.set_active(True)
def show_financeiro(self):
self.reset_selection()
self.ui.pages.setCurrentWidget(self.ui.ui_pages.financeiro)
self.ui.btn_financeiro.set_active(True)
def show_controle(self):
self.reset_selection()
self.ui.pages.setCurrentWidget(self.ui.ui_pages.controle)
self.ui.btn_controle_nfe.set_active(True)
def show_configuracoes(self):
self.reset_selection()
self.ui.pages.setCurrentWidget(self.ui.ui_pages.configuracoes)
self.ui.setting_button.set_active(True)
def toggle_button(self):
#Get Menu Qidth
menu_width = self.ui.left_menu.width()
#Check With
width = 70
if menu_width == 70:
width = 240
#Star Animation
self.animation = QPropertyAnimation(self.ui.left_menu, b'minimumWidth')
self.animation.setStartValue(menu_width)
self.animation.setEndValue(width)
self.animation.setDuration(300)
self.animation.start()

if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
sys.exit(app.exec())

尝试连接按钮后,系统应该转到另一个选项卡。

错误出现在"application_pages.addWidget(self.nfe)">

QMainWindow确实没有addWidget()方法。使用setCentralWidget()代替。请注意,您只能将一个小部件设置为中心部件。

相关内容

  • 没有找到相关文章

最新更新