[PyQt] Re: Help with help action

Thorsten Kampe thorsten at thorstenkampe.de
Thu Sep 27 12:29:46 BST 2007

* Mark Summerfield (Thu, 27 Sep 2007 08:45:59 +0100)
> On 2007-09-26, Thorsten Kampe wrote:
> > I'm trying to teach myself GUI programmming with the help of the new
> > PyQt book and the examples from the PyQt package. Although I've been
> > doing Python for five years I have a hard time doing OOP stuff.
> > Frankly, I never know when and where to put this "self" thing.
> My book assumes that you're comfortable with the basics of OOP (and does
> mention this in the first para of the Introduction), so it will be a bit
> of a climb for you!

I guess I am comfortable with OOP basics but I (like problably many 
Pythonistas) hardly ever use (in my case because my scripts are all 
less than one hundred lines of code).

I wouldn't say that OOP is overrated but Alex Martelli has said the 
wisest thing I've read about OOP:
| If the packaging is in terms of objects that typically comprise state 
| and behavior, you're using OOP. Some object-oriented languages force 
| you to use OOP for everything, so you end up with many objects which 
| lack either state or behavior.
What I actually wanted to say is that I'm not sure whether I have 
problems with OOP but I definitely have a problem with "self".

I've tried your and Michael's version


...works as well as 


while your...
helpDialog = QtGui.QDialog(self)
...works only with "self".

Anyway, thanks a lot for the code completion and improvement...


More information about the PyQt mailing list