Hi List,

I am running PySide 0.42 on windows with Python 2.6, i am currently
migrating my application which is using PyQt4 to PySide and found the
following incompatibility between PyQt4 and PySide which appears to be
unreasonable, methods that accept class enums can't accept integers of the
same value of enums?!, however when checking the type of these enum values
using the Python Type checking recommended mechanism "isinstance(obj, type)"
it yields an integer!!, while at the same time passing an integer to there
respective methods i.e: QFrame.setFrameShape(), it complains for parameters
being of incompatible types, kindly find below an illustration application
of the issue.

comment/uncomment the lines of : label.setFrameShape(QtGui.QFrame.Box) and
label.setFrameShape(1) to see that the one of the enum only works,....

can any body help with this?

##START OF CODE##
import sys, types
from PySide import QtCore, QtGui

app = QtGui.QApplication(sys.argv)

widget = QtGui.QWidget()
widget.resize(250, 150)
widget.setWindowTitle('testApp')

label = QtGui.QLabel(widget)
label.setText("Test Label")

if isinstance(QtGui.QFrame.Box, QtGui.QFrame.Shape) :
    print("Shape Detected, this is fine!")

if isinstance(QtGui.QFrame.Box, int) :
    print("Integer Detected, this shouldnt be an integer!")

# will not work, even QtGui.QFrame.Box == 1 and isinstance(QtGui.QFrame.Box,
int) returns True!!!!
# so, either QtGui.QFrame.Box shouldn't be an instance of int -> wrong
# or setFrameShape and other methods accepting enums should accept enums as
well

#working
#label.setFrameShape(QtGui.QFrame.Box)
#not working
label.setFrameShape(1)

label.show()
widget.show()

sys.exit(app.exec_())

##END OF CODE##

Best
Abdullah Abouzekry
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to