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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:35:56+00:00 2026-06-10T00:35:56+00:00

Summerfield’s Rapid GUI Programming with Python and Qt. I love the book in general.

  • 0

Summerfield’s “Rapid GUI Programming with Python and Qt”. I love the book in general. The first few chapters are the best Python primer I found online or otherwise, and the examples are varied and helpful (not perfect though, there’s some padding and retracing for sure- it could be far more direct).

My problem is that I feel I might be picking up bad habits from it. Instead of just dynamically assigning new attributes to existing object, the author uses “setData” functions, special MIMEData slots and whatnot. Here’s a good example from one of the first questions I asked on Stackoverflow:

Setting and getting "data" from PyQt widget items?

or, for instance, in a page-designer app:

def writeItemToStream(self, stream, item):
    if isinstance(item, QGraphicsTextItem):
        stream << QString("Text") << item.pos() \
               << item.matrix() << item.toPlainText() << item.font()
    elif isinstance(item, QGraphicsPixmapItem):
        stream << QString("Pixmap") << item.pos() \
               << item.matrix() << item.pixmap()
    elif isinstance(item, BoxItem):
        stream << QString("Box") << item.pos() \
               << item.matrix() << item.rect
        stream.writeInt16(item.style)

Am I right to think the author’s C++/Qt background might make his examples sub-optimal? Or should I keep trying to make sense of a lot of his choices?

  • 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-10T00:35:57+00:00Added an answer on June 10, 2026 at 12:35 am

    You have to remember that PyQt4 is a binding to Qt. A lot of what is done in one, is the same in the other, for API compatability.

    Obviously C++ is a static typed language and python allows you to simply assign attributes to object, but dont confuse that with something like a setData call. Normally those calls set internal members that are not exposed to you. This is where the binding aspect makes sense. In order for the C++ objects to get the interaction they expect, you would usually need to make use of the same api in pyqt

    One example of something very C++ related is the QVariant. It is an object that can represent many many different types. Python doesnt normally need this kind of object, but C++ would to hold dynamic types in one object. You will have to deal with this object when you work with say QSettings, or the model/view components.

    That book is an excellent learning tool and I would recommend not thinking about picking up bad habits. Mark knows what needs to be taught for an understanding of PyQt. As you learn python in general, you will easily be able to make these distinctions down the line.

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

Sidebar

Related Questions

I've just started programming in PyQt and I'm following Rapid GUI programming in Python
So, I'm reading this book: C++ GUI Programming with Qt 4, Second Edition by
I am pretty new to C++/Qt I am following the book 'C++ GUI Programming
The authors (Jasmin Blanchette & Mark Summerfield) of C++ GUI Programming with Qt has
I recently switched to Google closure for a new project. I am having trouble
I have a bunch of QComboBox es in a table. So that I know
I want check if a selected user exists within an OU (by the username
I have to populate an Advanced Data Grid which have the following fields: Continent->State->Society-->Actual
DataClassesDataContext dc = new DataClassesDataContext(); var summaryFieldDB = from b in dc.PropertyCompanies where (b.SummaryField.Contains(txtSearch))
The opposite of list flattening. Given a list and a length n return a

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.