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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:01:53+00:00 2026-05-26T04:01:53+00:00

In a PyQt4 Gui, I require the careful placement of multiple QPainter Pixmaps. When

  • 0

In a PyQt4 Gui, I require the careful placement of multiple QPainter Pixmaps.
When specifying the coordinates and height and width of the new Pixmaps, I require that all units be in pixels.
(Otherwise, my Gui would be ruined on a screen of a different resolution to my own).

When placing the Pixmap, I use DrawPixmap( QRect , QPixmap ) function.
The Pixmaps needed to be placed are in a list of QRects of Tuples of 4 integers, which specify the coordinates of the top-left corner of the Pixmap (in px) and te bottom-right corner of the Pixmap (in px).
eg:
Blocks = [QtCore.QRect(x1, y1, x2, y2), etc].

Sadly, The last two numbers of the tuple are interpreted as width and height when passed to DrawPixmap( QRect, QPixmap), which are in the units (cm).

My Question…
Is there a method to specify a Pixmaps dimensions entirely in pixels?
(Either by passing a pixel width and height, or the two pixel coordinates of the corners of the dimension box).

I Can’t find a way in the QPainter or QRect class references.
Thanks!


Specs:
Python 2.7
PyQt4
Windows 7 32bit
IDLE

  • 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-26T04:01:54+00:00Added an answer on May 26, 2026 at 4:01 am

    In the QPainter class reference, you can find different overloading of the drawPixmap method. Reading the documentation tells that QPainter::drawPixamp(QRect, QPixmap) do exactly what you want. It might be a specific issue with pyqt where the format of the QRect is recognized more as a QRectF. You can also use the overloaded function that gets the top left coordinates and the width and height of your area like: QPainter::drawPixamp(x, y, width, height, QPixmap)

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

Sidebar

Related Questions

I'm writing a GUI application with PyQt4 (Python3). One my friend pointed out that
I have a Python application (with GUI, using PyQt4) that gets spawned by the
I am having an issue with PyQt4. I want to create a new widget
I've an python GUI application, I use pyQt4. I build binary with bbfreeze (before
I create an .app using py2app, and the GUI was made with pyqt4, and
I've developed a Python application that runs both in the GUI mode and the
I have several QComboBoxes in my PyQt4/Python3 GUI and they are filled with some
In I my attempts at creating a GUI (a document viewer) with PyQt4, failing
Ive created a program using pyqt4 as GUI Ive used resource file or .qrc
I am using pyQt4 and want to have a Browse button in my GUI

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.