Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

PyQt en ejemplos (Sesión 5)

Es­ta se­sión ha­ce­mos tra­ba­jo pe­sa­do en De­sig­ne­r, in­clu­yen­do "pro­moted wi­dge­ts", "cus­tom slo­ts" y mu­cho má­s.

Ver tam­bién:

ZeD / 2009-04-12 09:20:

Hi, may I sugest a "session" argument?
Expand the designer adding a custom Widget.
Just to make an example... a matplotlib canvas.

ATM I need to add a "dummy" QWidget with the designer, then "substitute" it via code with a subclass of matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg
(look at http://matplotlib.svn.sourc... for an example WITHOUT the external .ui)

Roberto Alsina / 2009-04-12 13:13:

In fact, in session 5 that is there (sort of).

The editor widget is created in designer, but you can use anything that inherits qwidget in the same way, and do the "promotion" using designer, check the "Editor Widget" subsection.

ZeD / 2009-04-12 19:06:

yes, I was thinking about creating a custom QWidget and embed it directly into the Designer as in
but rethinking... maybe it will be just a rewrite of that guide...

Roberto Alsina / 2009-04-12 23:59:

Yes, that guide looks good enough for me :-)

Ibn Saeed / 2009-04-27 15:48:

Hello Alsina

Is it possible for you teach PyQt Online to students.

I would like to learn from an experienced programmer.

Is it possible ?

Roberto Alsina / 2009-04-27 17:18:

@Ibn Saeed: no, sorry, I already have a job that takes all my time, so I can't really do that, at least not very well.

The best path right now is probably getting Mark Summerfield's book ( and subscribing to the PyQt mailing list for help.

I am on the list, too, and I try to help out when I can.

Ibn Saeed / 2009-04-27 18:07:

@Alsina,Thanks for replying.

I will read the book by Mark Summerfield.

I am not very familiar with Mailing Lists, i am more of a Forum person.

Do you know of anyone who teaches Python in an online university ?

Roberto Alsina / 2009-04-27 18:28:

You can access the PyQt mailing list more like a forum here:

And while I don't know of anyone doing what you need, if he exists, he is in that list for sure ;-)

Ibn Saeed / 2009-04-27 19:05:

Thanks alsina, I will join the mailing list and give it a try.

Once again thanks for your help and please do create more tutorials for PyQt.

I think it would be a nice if you could start a series which would complete a full PyQt program.

You can go slow, showing the steps needed to write a working application. I think people would benefit more with this approach.

Just a suggestion

Roberto Alsina / 2009-04-27 19:23:

This series will end with a full working program. It may take a year, but it will ;-)

Ibn Saeed / 2009-04-27 20:16:

Thats excellent.

Ibn Saeed / 2009-04-27 20:37:

Alsina, i signed up at Nabble.

I posted a reply to one of the threads.

Here is what i received in my email:

You are not allowed to post to this mailing list, and your message has
been automatically rejected. If you think that your messages are
being rejected in error, contact the mailing list owner at

I think they dont allow the public to reply or post.

Roberto Alsina / 2009-04-27 20:45:

I think you may have to subscribe to the mailing list, too, but I am not sure.

ZeD / 2009-04-28 10:30:

Hi :)
I'm eagerly waiting lesson 6 :)

Have you thinked about a lesson to show "custom" data in the treeview?
In your example you have a date column for your task, but you enter a string in the QTreeWidgetItem;
The sorting by date, in the application, works... but just for an accident (str(date) return a "YYYY-MM-DD ... " string).
What about inserting (for example) numerical values? You will end up with the "notorius" natural sort order (

Roberto Alsina / 2009-04-28 10:47:

@ZeD yes, that is one of the mny bugs in session5's app :-)

Contents © 2000-2020 Roberto Alsina