Skip to content

Instantly share code, notes, and snippets.

@mattions
Created October 2, 2011 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattions/1257345 to your computer and use it in GitHub Desktop.
Save mattions/1257345 to your computer and use it in GitHub Desktop.
importing the right Qstring for Python 3 on windows
"""
This is a check to make sure the sip and the Qstrings play nicely in Windows,
where the PySide is using the new Python API (Python 3)
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19702.html
http://stackoverflow.com/questions/1400858/how-to-create-qstring-in-pyqt4
This could be easily removed when we move to Python 3
"""
if os.name == 'nt':
import sip
sip.setapi('QString', 2)
sip.setapi('QVariant', 2)
from PyQt4.QtCore import (Qt, SIGNAL, SLOT, QSize, QString,
pyqtSignature, pyqtProperty)
from PyQt4.QtCore import *
else:
from PyQt4 import QtGui, QtCore, uic
from PyQt4.QtCore import Qt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment