Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6740631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:37:44+00:00 2026-05-26T11:37:44+00:00

I have a somewhat strange problem. I’m coding a multithreaded app and am using

  • 0

I have a somewhat strange problem. I’m coding a multithreaded app and am using SIGNALS to communicate the QThread’s data to the GUI class data. Without further ado, here is a simplified code.

class GUI(uiMainWindow.MainWindow):
    def __init__(self, parent=None):
        super etc
        self.thread = Thread()
        self.connect(self.thread, SIGNAL("changeStatus(QString)"), self.setStatus, Qt.QueuedConnection)

    def setStatus(self, status):
        self.statusBar.setText(status)


class Thread(QThread):
    def __init__(self, parent=None, create=True):
        super etc
        self.create = create

    def run(self):
        if self.create:
            create_data()
        if not self.create:
            upload_data()

    def create_data(self):
        self.emit(SIGNAL("changeStatus(QString)"), "Changing the statusbar text")
        #rest of the code

    def upload_data(self):
        self.emit(SIGNAL("changeStatus(QString)"), "Changing the statusbar text")

Pretty basic, right? However, here’s the problem: the self.emit works only in create_data function, but not in upload_data (or for that matter, in any other function; I tried putting it in __init__ as well). I tried putting print "I got the status" + status in the setStatus function. Again, it works in the create_data() function, but not in the upload_data() function.

The differences between the two functions are relatively minor, and as far as I can tell, nothing is interfering with the self.emit function – in fact, in both cases, self.emit is only 4-5 lines “away” from the function definition.

This is really puzzling to me. Any help? Thanks in advance!

EDIT: again, as far as I can tell, the only difference between the two functions is in the run() – the first one is called if create parameter is True, and the second one if it is False.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:37:45+00:00Added an answer on May 26, 2026 at 11:37 am

    I was right in my post. The difference between Thread() and Thread(create=False) was crucial. I had to define a new method (one was self.thread = Thread() and the other self.diff_thread = Thread(create=False)) and connect to different slots to make it work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing a Rails app, and hit a somewhat strange quirk. I have
I have a strange problem with developing in Scala on Android. I'm using sbt
My problem is somewhat strange. I have started developing a web page with Aptana
Admittedly, this is a strange problem for me to have, but here is what
I have somewhat of a problem. We have a centralized interface engine that will
I'm experiencing what I would consider somewhat strange behavior. Specifically if I have a
I have somewhat of a strange question that is not really technical, but I
I have somewaht of a strange problem. I am not sure if I am
I have somewhat of a knowledge of the PHP coding language and I would
I have somewhat of a problem. My old webserver (windows 2003) have been replaced,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.