Skip to main content

Ralsina.Me — Roberto Alsina's website

PyQt By Example (Session 5)

I am fi­nal­ly pub­lish­ing my Lati­noWare 2008 tu­to­ri­al, in re­vised and ex­pand­ed for­m. It will prob­a­bly be a 10-­part se­ries, and here is ses­sion 5.

This ses­sion does heavy de­sign­er work, in­clud­ing pro­mot­ed wid­get­s, cus­tom slot­s, and much more.

See al­so:

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 http://doc.trolltech.com/qq...
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 (http://www.qtrac.eu/pyqtboo... 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:

http://www.nabble.com/PyQt-...

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
pyqt-owner@riverbankcomputing.com.
==========

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 (http://www.codinghorror.com...

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

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


Contents © 2000-2023 Roberto Alsina