Results 1 to 1 of 1

Thread: Change pixmap image with another image

  1. #1
    Join Date
    Jun 2021
    Qt products

    Default Change pixmap image with another image

    i want to change pixmap image with another image,

    Qt Code:
    1. def detect(self):
    2. imgage_path = "test/"+str(self.file_name[self.image-index])
    3. image = cv2.imread(image_path)
    4. .
    5. .
    6. cv2.imwrite(("test/"+str(self.file_name[self_index])),image)
    7. self.photo_img.setPixmap(QtGui.QPixmap("test/"+str(self.file_name[self.index])))
    9. def crr (self):
    10. if self.index%60==17 :
    11. self.photo_img.setPixmap(QtGui.QPixmap("test/crr_img25.jpg"))
    12. if self.index%60==18 :
    13. self.photo_img.setPixmap(QtGui.QPixmap("test/crr_img26.jpg"))
    To copy to clipboard, switch view to plain text mode 

    in my plan, pixmap display image ('test/img25).jpg') that index 17, pixmap image should be display ('test/crr_img25).jpg'). I tried my code when running until def crr , suddenly the main window closes. how to solve it?
    Last edited by d_stranz; 16th June 2021 at 16:17. Reason: missing [code] tags

Similar Threads

  1. Offset of a pixmap image
    By TheIndependentAquarius in forum Newbie
    Replies: 1
    Last Post: 30th October 2013, 13:38
  2. Draw Image into Pixmap/Image
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 19th May 2010, 07:56
  3. [problem]displaying image with Pixmap
    By crazy_inf in forum Qt Programming
    Replies: 1
    Last Post: 3rd July 2008, 10:49
  4. Qt 3.3.8 pixmap to/from image error
    By ksierens in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2008, 07:46
  5. Create pixmap image from string
    By Morea in forum Qt Programming
    Replies: 5
    Last Post: 17th November 2006, 17:38

Tags for this Thread


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.