Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Change pixmap image with another image
Forum Updated to NodeBB v4.3 + New Features

Change pixmap image with another image

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 2 Posters 477 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eiliiy_re
    wrote on last edited by eiliiy_re
    #1

    i want to change pixmap image with another image, iam newbie in python

    def detect1(self):
       image_path = "test/"+str(self.file_name[self.image_index])
       image = cv2.imread(image_path)
       .
       .
       cv2.imwrite(("test/"+str(self.file_name[self.image_index])),image)
       self.photo_img.setPixmap(QtGui.QPixmap("test/"+str(self.file_name[self.image_index])))
    
    def crr (self):
            if self.index%60==17:
                self.photo_img.setPixmap(QtGui.QPixmap("test/crr_img25.jpg"))
            if self.index%60==18: 
                self.photo_img.setPixmap(QtGui.QPixmap("test/crr_img26.jpg"))
    

    in my plan, pixmap display image ('img25).jpg') that index 17, pixmap image should be display ('crr_img25.jpg'). I tried my code when running until def crr , suddenly the main window closes. how to solve it? is my code wrong?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Do you get any error message ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      E 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Do you get any error message ?

        E Offline
        E Offline
        eiliiy_re
        wrote on last edited by
        #3

        @SGaist no message, just python shell is written 'restart'

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Can you provide a minimal runnable script that shows that behaviour ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved