[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: *** GMX Spamverdacht *** [PyQt] Questions about the PyQt examples
From: Andreas Pakulat <apaku () gmx ! de>
Date: 2007-03-18 17:40:16
Message-ID: 20070318174016.GA16723 () morpheus ! apaku ! dnsalias ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
On 18.03.07 22:28:12, Shriramana Sharma wrote:
>
> In the same #08, if I remove the word self from the line:
>
> self.emit(QtCore.SIGNAL("angleChanged(int)"), self.currentAngle)
>
> I get an error:
>
> Traceback (most recent call last):
> File "./008.py.showserror-buthowdoesitwork", line 62, in setAngle
> self . emit ( SIGNAL ( "angleChanged ( int )" ), currentAngle )
> NameError: global name 'currentAngle' is not defined
>
> But the program still works normally. How?
Because no object listens to the signal emitted here, thats IIRC
something that is used in a later tutorial.
> 4)
>
> In #02, the last but one line has a semicolon at the end. This is C
> syntax, not Python syntax. But still Python executes the program without
> any warning or error. How?
Read you python book again, a semicolon is proper Python syntax, but its
not necessary unless you want to put multiple statements onto the same
line
> 5)
>
> Why do the tutorials not use tr() for user visible strings?
Probably because the Qt translations are not covering the examples
> 6)
>
> I observed that a large part of the functions in the PyQt API take self
> as the first object (to emphasize that it should be called only on an
> instance of the class) but the calls in the examples do not include self
> as the first item. How is it that Python doesn't throw any errors?
Uhm, they do generally by doing self.foobar(). In that case Python calls
Class.foobar(self).
> 7)
>
> If there is no need to include "self", then why is it necessary to say
> "self" in the QWidget __init__ constructor whenever I subclass QWidget
> within PyQt?
See above it is necessary.
Andreas
--
Be cautious in your daily affairs.
[Attachment #5 (application/pgp-signature)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic