Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QGridLayout, QWidget
- from PyQt5.QtGui import QPixmap
- class Example(QWidget):
- def __init__(self):
- super().__init__()
- self.im = QPixmap("./image.png")
- self.label = QLabel()
- self.label.setPixmap(self.im)
- self.grid = QGridLayout()
- self.grid.addWidget(self.label,1,1)
- self.setLayout(self.grid)
- self.setGeometry(50,50,320,200)
- self.setWindowTitle("PyQT show image")
- self.show()
- if __name__ == '__main__':
- app = QApplication(sys.argv)
- ex = Example()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement