[PyKDE] Converting QStrings to Python strings

David Boddie david at sleepydog.net
Tue May 7 13:55:01 BST 2002


On Monday 06 May 2002 8:01 am, Janos Blazi wrote:

> print int(edit.text())
> --------------------------------------------------------------------------
>
> In this code I read a string from a QLineEdit and try to convert it to an
> integer but this is not possible as the return value edit.text() is a
> QString. (I also get a segmentation fault, who knows, why?)
>
> So how can I convert the QString to a Python string?

I have naively used this in the past:

    print int(edit.text().latin1())

David

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________




More information about the PyQt mailing list