0
我試圖將文本添加到樣式框中我有這裏,不能爲我的生活弄清楚。我知道這很簡單。我已閱讀文檔,但仍無法掌握它。我在這裏做錯了什麼?將文本添加到窗口小部件pyqt和python代碼
class Weather(QtGui.QWidget):
def __init__(self):
super(Weather, self).__init__()
self.initUI()
def initUI(self):
hbox = QtGui.QHBoxLayout(self)
topleft = QtGui.QFrame(self)
topleft.setFrameShape(QtGui.QFrame.Panel)
topright = QtGui.QFrame(self)
topright.setFrameShape(QtGui.QFrame.Panel)
bottom = QtGui.QFrame(self)
bottom.setFrameShape(QtGui.QFrame.Panel)
splitter1 = QtGui.QSplitter(QtCore.Qt.Horizontal)
splitter1.addWidget(topleft)
splitter1.addWidget(topright)
splitter1.addWidget(QtGui.QLabel('Humidity:{:0.1f}%'.format(humidity)))
splitter1.addWidget(QtGui.QLabel('Temp:{:0.1f} F'.format(temperature)))
splitter2 = QtGui.QSplitter(QtCore.Qt.Vertical)
splitter2.addWidget(splitter1)
splitter2.addWidget(bottom)
hbox.addWidget(splitter2)
self.setLayout(hbox)
QtGui.QApplication.setStyle(QtGui.QStyleFactory.create('Cleanlooks'))
self.setGeometry(300, 300, 300, 200)
self.setWindowTitle('Weather')
self.show()
而且我該如何刪除標題欄? –