Python 3 PyQt5 Show Image on Canvas Screen Using QPixmap Class Widget GUI Desktop App

Python 3 PyQt5 Show Image on Canvas Screen Using QPixmap Class Widget GUI Desktop App

Python 3 PyQt5 Show Image on Canvas Screen Using QPixmap Class Widget GUI Desktop App

import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

def window():
   app = QApplication(sys.argv)
   win = QWidget()
   l1 = QLabel()
   l1.setPixmap(QPixmap("profile.jpg"))

   vbox = QVBoxLayout()
   vbox.addWidget(l1)
   win.setLayout(vbox)
   win.setWindowTitle("QPixmap Demo")
   win.show()
   sys.exit(app.exec_())

if __name__ == '__main__':
   window()
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment