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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:36:46+00:00 2026-05-19T01:36:46+00:00

This has to be the biggest nuisance I’ve encountered with PyQT: I’ve hacked together

  • 0

This has to be the biggest nuisance I’ve encountered with PyQT: I’ve hacked together a thumbnailing thread for my application (I have to thumbnail tons of big images), and it looks like it would work (and it almost does). My main problem is this error message whenever I send a SIGNAL from my thread:

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

I can’t figure out how to get around this. I’ve tried passing a QIcon through my SIGNAL, but that still generates the same error. If it helps, here’s the code blocks which deal with this stuff:

The Thumbnailer class:

class Thumbnailer(QtCore.QThread):
  def __init__(self, ListWidget, parent = None):
    super(Thumbnailer, self).__init__(parent)
    self.stopped = False
    self.completed = False
    self.widget = ListWidget

  def initialize(self, queue):
    self.stopped = False
    self.completed = False
    self.queue = queue

  def stop(self):
    self.stopped = True

  def run(self):
    self.process()
    self.stop()

  def process(self):
    for i in range(self.widget.count()):
      item = self.widget.item(i)

      icon = QtGui.QIcon(str(item.text()))
      pixmap = icon.pixmap(72, 72)
      icon = QtGui.QIcon(pixmap)
      item.setIcon(icon)

The part which calls the thread (it occurs when a set of images is dropped onto the list box):

  self.thread.images.append(f)

  item = QtGui.QListWidgetItem(f, self.ui.pageList)
  item.setStatusTip(f)

  self.thread.start()

I’m not sure how to handle this kind of stuff, as I’m just a GUI newbie 😉

Thanks to all.

  • 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-19T01:36:47+00:00Added an answer on May 19, 2026 at 1:36 am

    After many attempts, I finally got it. I can’t use a QIcon or QPixmap from within a non-GUI thread, so I had to use a QImage instead, as that transmits fine.

    Here’s the magic code:

    Excerpt from the thumbnailer.py QThread class:

      icon = QtGui.QImage(image_file)
      self.emit(QtCore.SIGNAL('makeIcon(int, QImage)'), i, icon)
    

    makeIcon() function:

      def makeIcon(self, index, image):
        item = self.ui.pageList.item(index)
        pixmap = QtGui.QPixmap(72, 72)
        pixmap.convertFromImage(image) #   <-- This is the magic function!
        icon = QtGui.QIcon(pixmap)
        item.setIcon(icon)
    

    Hope this helps anyone else trying to make an image thumbnailing thread 😉

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

Sidebar

Related Questions

Update II Problem Solved but Why? This has been the biggest headache ever. My
This has been one of the biggest obstacles in teaching new people ColdFusion. When
This has defeated me. I want to have a static class variable which is
This has been a rather problematic issue on numerous occasions. We have alot of
SETUP : I have this app which has 4 activities in a linear path,
This has always bothered me... Let's say I have an interface IFiddle and another
The application in question has already been deployed. I have found out about ACRA
this has baffled me for a couple of hours now. Why do i get
this has been an ongoing problem with me, ive been trying to make a
This has been a massive headache. We use Ning as a our platform for

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.