PyQt5 Tutorial - Etichetta

PyQt5 Tutorial - Etichetta

Impareremo ad usare il widget di etichette PyQt5 QLabel in questo tutorial. Widget per etichette PyQt5 Aggiungeremo due etichette alla nostra finestra, dove una di queste etichette conterrà del testo e l’altra un’immagine. import sys from PyQt5 import QtWidgets, QtGui def basicWindow(): app = QtWidgets.QApplication(sys.argv) windowExample = QtWidgets.QWidget() labelA = QtWidgets.QLabel(windowExample) labelB = QtWidgets.QLabel(windowExample) labelA.setText("Label Example") labelB.setPixmap(QtGui.QPixmap("python.jpg")) windowExample.setWindowTitle("Label Example") windowExample.setGeometry(100, 100, 300, 200) labelA.move(100, 40) labelB.move(120, 120) windowExample.show() sys.exit(app.exec_()) basicWindow() Dove,

Tags

PyQt5 Button PyQt5 Menubar

Articoli più popolari

Articoli aggiornati di recente