Hello,
When I try to run this and script:
#!/usr/bin/python2.4
# colordialog.py
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
class ColorDialog(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
color = QtGui.QColor(0, 0, 0)
self.setGeometry(300, 300, 250, 180)
self.setWindowTitle('ColorDialog')
self.button = QtGui.QPushButton('Dialog', self)
self.button.setFocusPolicy(QtCore.Qt.NoFocus)
self.button.move(20, 20)
self.connect(self.button, QtCore.SIGNAL('clicked()'), self.showDialog)
self.setFocus()
self.widget = QtGui.QWidget(self)
self.widget.setStyleSheet("QWidget { background-color: %s }"
% color.name())
self.widget.setGeometry(130, 22, 100, 100)
def showDialog(self):
color = QtGui.QColorDialog.getColor()
self.widget.setStyleSheet("QWidget { background-color: %s }"
% color.name())
app = QtGui.QApplication(sys.argv)
cd = ColorDialog()
cd.show()
app.exec_()
I get the following error message:
Traceback (most recent call last):
File "untitled text 5", line 39, in ?
cd = ColorDialog()
File "untitled text 5", line 27, in __init__
self.widget.setStyleSheet("QWidget { background-color: %s }"
AttributeError: setStyleSheet
This code came from:
http://www.zetcode.com/tutorials/pyqt4/dialogs/
_______________________________________________
Pythonmac-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig