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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:48:53+00:00 2026-06-15T20:48:53+00:00

A similar question was asked here , but without description how to rescale the

  • 0

A similar question was asked here, but without description how to rescale the image. I only found the C++ specs for QPixmap so far, and a reference guide for pyQT4. But the latter does not seem to have any reference to QPixmap.

Question: Does anyone know how to show a rescaled version of the full image based on the code in the first link, and/or where I can find the pyQt4 specs?

  • 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-15T20:48:54+00:00Added an answer on June 15, 2026 at 8:48 pm

    You could use the QPixmap.scaledToHeight or QPixmap.scaledToWidth method:

    import sys
    from PyQt4 import QtGui
    app = QtGui.QApplication(sys.argv)
    window = QtGui.QMainWindow()
    window.setGeometry(0, 0, 400, 200)
    pic = QtGui.QLabel(window)
    pic.setGeometry(10, 10, 400, 200)
    pixmap = QtGui.QPixmap(FILENAME)
    pixmap = pixmap.scaledToHeight(200)
    pic.setPixmap(pixmap)
    
    window.show()
    sys.exit(app.exec_())    
    

    You can find documentation on PyQT classes (including QPixmap) here.

    Sometimes when I am lazy and do not want to read documentation, I use this:

    def describe(obj):
        for key in dir(obj):
            try:
                val = getattr(obj, key)
            except AttributeError:
                continue
            if callable(val):
                help(val)
            else:
                print('{k} => {v}'.format(k = key, v = val))
            print('-'*80)
    
    pixmap = QtGui.QPixmap(FILENAME)
    describe(pixmap)
    

    which prints lots of output about all the attributes of the object passed to describe. In this case, you can find relevant methods by searching for the string -> QPixmap since these are the methods that return a new QPixmap. That’s how I found scaledToHeight and scaledToWidth.

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

Sidebar

Related Questions

A similar question was asked here but without a satisfying answer. I'm trying to
I asked a very similar question here but since it is such a fundamental
I found this on Google, click here , which someone asked a similar question,
I asked a similar question here a while back but all the answers were
I found similar questions asked here but there weren't answers to my satisfaction. So
This question is similar to the one i asked here . But its related
I have asked a similar question previously but it was never resolved so here
Similar question have been asked here but none fits to my need. I made
A similar question was asked here , but the answers generally all seem to
There was a similar question asked here three years ago, but I want to

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.