<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 12pt; color: #000000'>Demetrius,<br><br>I think you are right, but how can I achieve the same functionality with Python 3.1.1, as I do with Python 2.6? (i.e., left(5).toUpper()) for the "str" that's returned by Python 3.1.1?<br><br>I looked at <span style="font-weight: bold;">"[0:0<5]".format(self.ui.txtText.text())"</span> and that seemed to work, although it didn't implement the <span style="font-weight: bold;">"toUpper()</span> feature and I really need a solution that will do so. I also have another string from a QLineEdit object that I want to convert to an integer value and I had written it as follows:<br><br><span style="font-weight: bold;">numbering = self.ui.txtNumber.text().toInt()</span><br><br>But this also fails with an error on Python 3.1.1, indicating that a "str" object has on attribute "toInt()". So, basically, I need to convert both of these to be compatible with Python 3.1.1 and I'm not sure how to do so.<span style="font-weight: bold;"><span style="font-weight: bold;"><span style="font-weight: bold;"></span></span></span> Any help will be appreciated.<br><br>-rich-<br><br>----- Original Message -----<br>From: "Demetrius Cassidy" <dcassidy36@mass.rr.com><br>To: "Richard Parker" <r.richardparker@comcast.net><br>Cc: "PYQT" <pyqt@riverbankcomputing.com><br>Sent: Tuesday, January 12, 2010 2:49:41 PM GMT -08:00 US/Canada Pacific<br>Subject: Re: [PyQt] Different Behavior between Python 2.6 and Python 3.1.1<br><br>I think .text() in Python 3.1 with PyQt4 is returning a python 'str' <br>object, instead of a QString. Try and do type(self.ui.txtText.text()) <br>and see what it returns.<br><br>Richard Parker wrote:<br>> I have the following statement in an application that runs fine with <br>> Python 2.6 (and PyQt):<br>><br>> text = self.ui.txtText.text().left(5).toUpper()<br>><br>> In Python 3.1.1 (with PyQt), I get the following error for the first <br>> statement:<br>><br>> " text = self.ui.txtText.text().left(5).toUpper()<br>> AttributeError: 'str' object has no attribute 'left' "<br>><br>><br>> The "ui.txtText.text" object is a QLineEdit object, whose <br>> documentation indicates that its "text()" function returns a QString <br>> object, whose documentatation states that the "left(self, n)" and <br>> "toUpper() functions are supported. What has changed between Python <br>> 2.6 and Python 3.1 that would account for this error?<br>><br>> Thanks.<br>><br>> ------------------------------------------------------------------------<br>><br>> _______________________________________________<br>> PyQt mailing list PyQt@riverbankcomputing.com<br>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt<br><br></div></body></html>