[PyKDE] Re: Qstring problem

Jorge Godoy godoy at ieee.org
Tue Mar 1 13:12:52 GMT 2005


Flávio Codeço Coelho <fccoelho at fiocruz.br> writes:

> My question is how do I get the string so that I can convert it to int?

Flávio,


Have you tried "str(QLineEdit.text())"? 


It works here, since QString has an __str__ method.


>>> QString('123')
<__main__.qt.QString object at 0x4039983c>
>>> int(QString('123'))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: int() argument must be a string or a number
>>> int(str(QString('123')))
123
>>>


Até mais,
Godoy.




More information about the PyQt mailing list