Qcolor name pyside6 - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Qcolor name pyside6 (/thread-38946.html) |
Qcolor name pyside6 - PatM - Dec-13-2022 I have an error that works if I print but not if I try to use the value. I've tried everything I can think of but can't understand what is going wrong. I get a color from a QColordialog then try to get the string from it. The print statement shows "#000000" but then I get a QColor not callable error on the " Prefs.fontColor(_color)" line. Any clues? def chooseColor(self): color = QColorDialog() color.setCurrentColor(Prefs.fontColor) color.exec() _color = color.currentColor() print(_color.name()) _color = str(_color.name()) Prefs.fontColor(_color) #and the Prefs part is @property def fontColor(self): return QColor.fromString(self._dict["fontColor"]) @fontColor.setter def fontColor(self,val): self._dict["fontColor"] = val RE: Qcolor name pyside6 - deanhystad - Dec-13-2022 fontColor is a property. You do not use function calling syntax when getting or setting a property value Instead of this: Prefs.fontColor(_color)Do this: Prefs.fontColor = _color RE: Qcolor name pyside6 - PatM - Dec-13-2022 Arg, I just couldn't figure it out, to fixated on the QColor error message and completely forgetting my years of windows properties Ugh! Thanks! |