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 8441773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:39:17+00:00 2026-06-10T08:39:17+00:00

This may be a little long post, so, thanks in advance to be with

  • 0

This may be a little long post, so, thanks in advance to be with me till the end. Here is the problem, (i think a fairly basic one, just my inexperience with PiSide and Qt making it harder for me.) I have a main window with one menu item, suppose “Process”. the code is following –

from PySide import QtCore, QtGui

class Ui_MainWindow(object):

      def setupUi(self, MainWindow, AppObj):
            .
            .
            self.statusbar = QtGui.QStatusBar(MainWindow)
            self.statusbar.setObjectName("statusbar")
            MainWindow.setStatusBar(self.statusbar)
            .
            .
            .
           self.actionProcess = QtGui.QAction(MainWindow)
           self.actionProcess.setObjectName("actionProcess")
           self.actionProcess.triggered.connect(self.myappObj.menuActionProcess) 
           .

Here self.myappobj refers to a app class I have created which acts as the main logic controller for my app. The code –

from PySide import QtCore, QtGui
from MainWindow import Ui_MainWindow

class App(QtGui.QDialog):
      def __init__(self, parent=None):
          self.__mainWindow = QtGui.QMainWindow()
          self.__mainWindowDesignContext = Ui_MainWindow()
          self.__mainWindowDesignContext.setupUi(self.__mainWindow, self)
          self.__mainWindow.show()
      def menuActionProcess(self):
          self.processThread = BatchProcesser()
          self.progressBar = QtGui.QProgressBar()
          statusBar.addWidget(self.progressBar)
          self.progressBar.show()
          self.progressBar.setMinimum(0)
          self.progressBar.setMaximum(100)
          QtCore.QObject.connect(self.processThread, QtCore.SIGNAL("progress(int)"),self.progressBar, QtCore.SLOT("setValue(int)"), QtCore.Qt.DirectConnection)
          if not self.processThread.isRunning():
              self.processThread.exiting = False
              self.processThread.start()

So, it is easy to see that what i am trying to do here is to create a main window. Add a menu there called “Process”, clicking on which should trigger the callback menuActionProcess method in the app class, where I am making a progress bar and attaching it with the Status Bar of my main window (The actual code has many other things, what i give here is the necessary parts rearranged as an pseudo example)
and finally in the BatchProcesser class mentioned in the above code, I am doing this –

from PySide.QtGui import *
from PySide.QtCore import *

class BatchProcesser(QThread):
     __errorHappened = False
     def __init__(self, parent=None):
         QThread.__init__(self, parent)
         self.exiting = False
     def run(self):
         for a in range(101):
            print a
            QThread.msleep(100)
            self.emit(SIGNAL("progress(int)"), a)
            print a

In my understanding this should update the Progress Bar attached to the Status Bar in a different thread than the main thread. This will allow the user to interact with the GUI freely.

Right now, If i try to rin this, everything is fine until i hit the Process menu. Then, the progress bar appeases but does not update and the console is full with error –

0 QPixmap: It is not safe to use pixmaps outside the GUI thread

QPixmap: It is not safe to use pixmaps outside the GUI thread

QPixmap: It is not safe to use pixmaps outside the GUI thread

QPixmap: It is not safe to use pixmaps outside the GUI thread

0

1

QPixmap: It is not safe to use pixmaps outside the GUI thread

QPixmap: It is not safe to use pixmaps outside the GUI thread

QPixmap: It is not safe to use pixmaps outside the GUI thread

QPixmap: It is not safe to use pixmaps outside the GUI thread

[xcb] Unknown request in queue while dequeuing

[xcb] Most likely this is a multi-threaded client and XInitThreads has
not been called

[xcb] Aborting, sorry about that.

python: ../../src/xcb_io.c:178: dequeue_pending_request: Assertion
`!xcb_xlib_unknown_req_in_deq’ failed.

Aborted (core dumped)

Any help is very much required for me. I am unable to find out and/ot point the original reason of the error and fix the same.

  • 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-06-10T08:39:18+00:00Added an answer on June 10, 2026 at 8:39 am

    The problem lies in how you connect the signal to the slot:

          QtCore.QObject.connect(self.processThread, QtCore.SIGNAL("progress(int)"),self.progressBar, QtCore.SLOT("setValue(int)"), QtCore.Qt.DirectConnection)
    

    Here, you explicitely enforce a DirectConnection. This is wrong! It makes the slot be processed in the caller’s thread. This means that the GUI update of the progressBar happens in the process thread, not in the GUI thread. However, drawing is only allowed in the GUI thread.

    It is perfectly fine to connect a signal from one thread to a slot from another. However, you need either AutoConnection (the default, which will recognize the threads and use QueuedConnection) or QueuedConnection.

    This line should fix your problem:

          QtCore.QObject.connect(self.processThread, QtCore.SIGNAL("progress(int)"),self.progressBar, QtCore.SLOT("setValue(int)"), QtCore.Qt.QueuedConnection)
    

    See http://doc.qt.io/archives/qt-4.7/qt.html#ConnectionType-enum.

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

Sidebar

Related Questions

This problem may be a little broad, but I'm going to go ahead and
I think the question may seem a little weird, but here's the details. The
This may be a little hard to describe since I don't have a sample.
I realize something like this has been asked, but this may be a little
This question may seem a little bit stackoverflow-implementation specific, but I have seen a
This need may sound a little convoluted, and if so, then I am open
This may be have a better name than custom tab completion, but here's the
This may be a simple question but I can;t find the answer anywhere. Here
Apologies in advance for the relatively long post - I've tried to provide as
I'm afraid that this one is a little tricky since I couldn't recreate the

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.