Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. PyQT Update QLabel Threading/Signals Issue
Forum Updated to NodeBB v4.3 + New Features

PyQT Update QLabel Threading/Signals Issue

Scheduled Pinned Locked Moved Language Bindings
1 Posts 1 Posters 2.6k 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.
  • M Offline
    M Offline
    maboroshi
    wrote on 11 Nov 2011, 22:21 last edited by
    #1

    I am trying to update a QPixMap QLabel image on each successful iteration in my video function however the threading doesn't work

    What I see happening is it sends the entire loop before the signal sends its data back. I am confused why it's doing this

    The code in Question I posted below

    [code]
    def video(self):

        cam = Device()
        cam.setResolution(640, 480)
        a = datetime.datetime.now().strftime("%Y%m%dT%H%M%S%ms")
        b = str(a)
        for i in xrange(5):
            try:
                snapshot = os.getcwd() + '\\camImages\\' + '%s.png' % (b)
                cam.saveSnapshot(snapshot)
                self.client(chr(CMD_VIDEO), snapshot)
                print "sent"
                continue
            except:
                print "missed image"
                continue
    
    def viewVideo(self, msg):
        print "received"
        self.myVideo.setPixmap(QPixmap(msg))
        self.myVideo.repaint()
    

    [/code]

    Let me explain: In my main GUI class I have it threaded I use this to initiate a signal

    [code]

    self.thread.mySignal5.connect(self.viewVideo)
    

    [/code]

    Then I have those functions I posted earlier (see above). In my Worker/Threading class I initiate mySignal5 like this

    [code]

    mySignal5 = pyqtSignal('PyQt_PyObject')
    

    [/code]

    Then in my run function where I run my server, I have:

    [code]

    elif cmd == CMD_VIDEO:
        self.mySignal5.emit(msg)
        #print msg
    

    [/code]

    *cheers if anyone can help

    The full code is posted here

    [url]http://code.suck-o.com/42399[/url]

    1 Reply Last reply
    0

    1/1

    11 Nov 2011, 22:21

    • Login

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