Results 1 to 5 of 5

Thread: PyQt5 QPixmap

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2015
    Posts
    27
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default PyQt5 QPixmap

    I've just converted a small app from Python2/Qt4 to Python3/Qt5 without much difficulty. It displays .jpg images, but it no longer displays .tif images.
    Qt Code:
    1. #! /usr/bin/python3
    2.  
    3. import sys
    4. from PyQt5 import QtCore, QtGui, QtWidgets
    5. from test_ui import Ui_MainWindow
    6.  
    7. class MyWindowClass(QtWidgets.QMainWindow):
    8. def __init__(self, parent=None):
    9. QtWidgets.QMainWindow.__init__(self, parent)
    10. self.ui = Ui_MainWindow()
    11. self.ui.setupUi(self)
    12.  
    13. self.ui.buttonProcessOne.clicked.connect(self.pushButtonClicked)
    14.  
    15. def pushButtonClicked(self):
    16. myPixmap = QtGui.QPixmap('image1.tif')
    17. self.ui.label.setScaledContents(True)
    18. self.ui.label.setPixmap(myPixmap)
    19.  
    20.  
    21. if __name__ == "__main__":
    22. app = QtWidgets.QApplication(sys.argv)
    23. mywindow = MyWindowClass()
    24. mywindow.show()
    25. sys.exit(app.exec_())
    To copy to clipboard, switch view to plain text mode 
    I have tried QtWidgets.QPixmap instead of QtGui.
    Last edited by ChrisOfBristol; 4th April 2015 at 13:03.

Similar Threads

  1. QPixmap
    By dragon in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2010, 19:19
  2. Replies: 4
    Last Post: 28th August 2008, 13:13
  3. Replies: 1
    Last Post: 21st August 2008, 07:44
  4. Replies: 5
    Last Post: 9th April 2007, 14:26
  5. What's faster: QPixmap-to-QImage or QImage-to-QPixmap
    By forrestfsu in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2006, 17:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.