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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:40:21+00:00 2026-06-09T14:40:21+00:00

I am trying to do some work in a separate thread, in Python. I’m

  • 0

I am trying to do some work in a separate thread, in Python. I’m using PyQt so my threads are QThreads.

The work itself involves loading large images with PIL and converting the image to a QImage.

Here is an example of some code that loads an image over and over within a worker thread:

class testThread(QtCore.QThread):
    def run(self):
        while True:
            im = Image.open('c:\zheadline.tif')
            try:
                imgData = ImageQt.ImageQt(im)
                print (imgData.width())
            except:
                print ("Image load error")

The image is quite large (16k), so it can take a couple of seconds to actually load it. However, during this time, the GUI becomes very unresponsive, often freezing for a few hundred milliseconds.

Why is this? My machine has 16 cores so there’s no reason why the work from 1 thread would cause a slowdown in all of the others, right?

Basically I want to be able to load these large images in the background without interrupting the user experience at all. Does anyone have any ideas how I can push the main work off to another thread without disturbing the main GUI thread at all?

Some other info: I’m starting the QThreads with ‘thread.start()’. Also, the GUI doesn’t completely freeze during the load time…it just becomes extremely laggy and slow, freezing intermittently.

  • 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-09T14:40:23+00:00Added an answer on June 9, 2026 at 2:40 pm

    The python interpreter can only run in one thread at a time (read about the Global Interpreter Lock), so probably one or both of Image.open and ImageQt.ImageQt is doing a lot of work in python without releasing the GIL.

    A possible solution is to load images in a separate process and transfer the data via shared memory. Pyqtgraph supports remote widget rendering this way: https://github.com/pyqtgraph/pyqtgraph/blob/master/pyqtgraph/widgets/RemoteGraphicsView.py. See the ‘remoteSceneChanged’ method for how the QImage was reconstructed from shared memory.

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

Sidebar

Related Questions

I am trying to perform some work in a separate thread and stop that
I'm trying to get some HTML to work with my python code. I've got
I'm trying to work out why some of my test cases (using RhinoMocks 3.6
Trying to do some work with text selected in a UIWebView. There are 2
I'm trying to do some work with C# and XML in a cross-platform app
Im trying to get some auto complete to work. I have this URL i
I am trying to do some style-check/translation work for Java programs. First I would
I am trying to test some async methods involving the HttpClient work with vs
I'm trying to make some input fields that I would like to work like
I am trying to adapt some (to me) very complicated code to work with

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.