Guest User

Untitled

a guest
Sep 23rd, 2020
19
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2. from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QGridLayout, QWidget
  3. from PyQt5.QtGui import QPixmap
  4.  
  5. class Example(QWidget):
  6.  
  7. def __init__(self):
  8. super().__init__()
  9.  
  10. self.im = QPixmap("./image.png")
  11. self.label = QLabel()
  12. self.label.setPixmap(self.im)
  13.  
  14. self.grid = QGridLayout()
  15. self.grid.addWidget(self.label,1,1)
  16. self.setLayout(self.grid)
  17.  
  18. self.setGeometry(50,50,320,200)
  19. self.setWindowTitle("PyQT show image")
  20. self.show()
  21.  
  22. if __name__ == '__main__':
  23. app = QApplication(sys.argv)
  24. ex = Example()
  25. sys.exit(app.exec_())
RAW Paste Data