*** GMX Spamverdacht *** [PyQt] Questions about the PyQt examples
Andreas Pakulat
apaku at gmx.de
Sun Mar 18 17:40:16 GMT 2007
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070318/d37f42e8/attachment.bin
More information about the PyQt
mailing list