Re: PyQt + python3?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/20/2010 04:11 PM, Rex Dieter wrote:
> Stanislav Ochotnicky wrote:
> 
>> On 10/20/2010 02:38 PM, Neal Becker wrote:
>>> Has anyone attempted a pyqt for python3?
>>
>> I did. It failed (not on Fedora though and I didn't investigate at the
>> time). I seem to remember some symbol problems with QString class that
>> was reported when I tried to import PyQt from python3 interpreter.
> 
> python3-PyQt4 should work (theoretically), but has seen very little real-
> world use or testing yet.  Please file bugs.

FYI I found solution to the problem I was encountering when using PyQt4
with Python 3.x.

PyQt 4.6+ uses new API for QString and QVariant when run on Python 3.x.
That has to do with unicode string being default in Python 3.x.

Therefore you can replace all occurrences of QString with ordinary
python strings.

For my use-case I wanted to have the same code for Python 2.x/3.x so I
did this:

try:
    from PyQt4.QtCore import QString
except ImportError:
    # we are using Python3 so QString is not defined
    QString = type("")



-- 
Stanislav Ochotnicky <sochotnicky@xxxxxxxxxx>
Associate Software Engineer - Base Operating Systems Brno

PGP: 71A1677C
Red Hat Inc.                               http://cz.redhat.com

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux