[PyQt] Moving PyQt programs to Python 3

Algis Kabaila akabaila at pcug.org.au
Thu Jul 14 10:28:46 BST 2011


On Thu, 14 Jul 2011 06:28:48 PM Phil Thompson wrote:
> On Thu, 14 Jul 2011 14:26:40 +1000, Algis Kabaila <akabaila at pcug.org.au>
> 
> wrote:
> > 1. How to tell which Python version a given PyQt is bound to?
> 
> sys.hexversion?

I don't think that answers the (reformatted) question.  From idle the 
sys.hexversion does show some magic number
>>> import sys
>>> sys.hexversion
50462960
>>> 
But even if that number relates to the version of Python, it tells nothing 
about the version of Python at binding to PyQt. The programs that use PyQt 
depend on the version of Python as well as the versions of PyQt and Qt itself.  
It would be helpful to be able to check those versions from PyQt alone. 
> 
> > 2. get open File Name dialog
> See...
> 
> http://www.riverbankcomputing.com/static/Docs/PyQt4/html/python_v3.html#qfi
> ledialog

Having read the reference and having corrected the File Dialog method, the 
dialog works without a hiccup.  Here is the corrected version, just in case 
there are other people on the list that are as negligent as I:

*****************
 def open(self):
        filename = QFileDialog.getOpenFileName(
                self, "Open File", ".", "Files (*.*)",
                QFileDialog.DontUseNativeDialog)
        self.plainTextEdit.appendPlainText(filename)
*****************
> The different APIs supported by sip.setapi() are intended to be used as
> portability aids.
> 
> Phil
> 

Phil, Thank you for your patience and precise advice. It does mean so much!
Gratefully,  Al.


More information about the PyQt mailing list