python在全屏显示时不显示新添加的元素
在此之后使用showFullScreen()函数时,不会显示新添加的元素,但可以删除元素 另外,如果我在元素添加代码后编写showFullScreen(),元素就会显示出来python在全屏显示时不显示新添加的元素,python,qt,fullscreen,Python,Qt,Fullscreen,在此之后使用showFullScreen()函数时,不会显示新添加的元素,但可以删除元素 另外,如果我在元素添加代码后编写showFullScreen(),元素就会显示出来 class MyApp(QtGui.QWidget): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setGeometry(300, 300, 600, 600)
class MyApp(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setGeometry(300, 300, 600, 600)
resolution = QtGui.QDesktopWidget().screenGeometry()
self.wheight = resolution.height()
self.wwidht = resolution.width()
self.centralwidget = QtGui.QWidget(self)
self.centralwidget.setObjectName("first")
self.splash_from = QtGui.QWidget(self.centralwidget)
self.splash_from.setGeometry(QtCore.QRect((self.wwidht - 1000) / 2, (self.wheight - 761) / 2, 1000, 761))
self.splash_from.setObjectName(("Splash"))
self.logo_img = QtGui.QLabel(self.splash_from)
self.logo_img.setPixmap(QtGui.QPixmap(os.getcwd() + "/logo.png"))
self.splash_from2 = QtGui.QWidget(self.centralwidget)
self.splash_from2.setGeometry(QtCore.QRect(50, ((self.wheight - 761) / 2) + 761, 700, 100))
self.splash_from2.setObjectName(("Splash"))
self.logo_text = QtGui.QLabel(self.splash_from2)
self.logo_text.setGeometry(QtCore.QRect(0, 0, 15000, 100))
self.logo_text.setStyleSheet('font-size: 18pt; color:red')
self.logo_text.setText(u"Loading...")
self.threadPool = []
self.showFullScreen();
self.splash_from2 = QtGui.QWidget(self.centralwidget)
self.splash_from2.setGeometry(QtCore.QRect(50,50,500,500))
self.splash_from2.setObjectName(("Splash"))
self.logo_text = QtGui.QLabel(self.splash_from2)
self.logo_text.setGeometry(QtCore.QRect(0, 0, 15000, 100))
self.logo_text.setStyleSheet('font-size: 18pt; color:red')
self.logo_text.setText(u"test...")
# self.showFullScreen();
感谢您的帮助,也为糟糕的英语感到抱歉:)您为什么要在
\uuuu init\uuu
中呼叫showFullScreen
?\uuuu init\uuuu
不应显示小部件。您应该编写app=MyApp()app.showFullScreen()
。另外,如果你想强制更新,你应该使用update()
方法。@Bakuriu,谢谢我添加了show(),比如self.layer\u form.show(),它显示了。谢谢你的回答:)