[PyQt] Repr for "value" objects
Phil Thompson
phil at riverbankcomputing.co.uk
Mon Dec 17 14:48:48 GMT 2007
On Monday 17 December 2007, Giovanni Bajo wrote:
> Hi,
>
> there are many classes in PyQt which would benefit from a custom
> __repr__ method to show their contents. For instance, I'm getting tired
> of having to write:
>
> def mousePressEvent(self, e):
> print e.pos().x(), e.pos().y()
>
> instead of:
>
> def mousePressEvent(self, e):
> print e.pos()
>
> just because I otherwise get "<PyQt4.QtCore.QPoint object at 0x298EA468>".
>
> Are there any plans to add this to PyQt?
It's on the TODO list.
> I'm happy to provide a list of
> objects that might have a custom repr method, and even to actually write
> the code (if Phil explains me how he prefers this to be submitted --
> given metasip).
A list would help. The code would help more (just a patch against the source
would be fine).
Phil
More information about the PyQt
mailing list