<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&lt;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 =&nbsp; 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" &lt;dcassidy36@mass.rr.com&gt;<br>To: "Richard Parker" &lt;r.richardparker@comcast.net&gt;<br>Cc: "PYQT" &lt;pyqt@riverbankcomputing.com&gt;<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>&gt; I have the following statement in an application that runs fine with <br>&gt; Python 2.6 (and PyQt):<br>&gt;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; text = self.ui.txtText.text().left(5).toUpper()<br>&gt;<br>&gt; In Python 3.1.1 (with PyQt), I get the following error for the first <br>&gt; statement:<br>&gt;<br>&gt; " &nbsp; &nbsp;text = self.ui.txtText.text().left(5).toUpper()<br>&gt; AttributeError: 'str' object has no attribute 'left' "<br>&gt;<br>&gt;<br>&gt; The "ui.txtText.text" object is a QLineEdit object, whose <br>&gt; documentation indicates that its "text()" function returns a QString <br>&gt; object, whose documentatation states that the "left(self, n)" and <br>&gt; "toUpper() functions are supported. What has changed between Python <br>&gt; 2.6 and Python 3.1 that would account for this error?<br>&gt;<br>&gt; Thanks.<br>&gt;<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>&gt; _______________________________________________<br>&gt; PyQt mailing list &nbsp; &nbsp;PyQt@riverbankcomputing.com<br>&gt; http://www.riverbankcomputing.com/mailman/listinfo/pyqt<br><br></div></body></html>