You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if name == 'main':
app = QApplication(sys.argv)
ex = MyApp()
sys.exit(app.exec_())`
AttributeError: type object 'ColorRole' has no attribute 'Text'
During handling of the above exception, another exception occurred:
File "D:\study\pyqt\test.py", line 18, in MyApp
apply_stylesheet(app, theme='dark_teal.xml')
File "D:\study\pyqt\test.py", line 25, in
ex = MyApp()
AttributeError: 'QPalette' object has no attribute 'set_color'
version is
qt-material 2.14
PyQt5 5.15.1
in init.py file
I see u define pyqt5 as this code
"
try:
print(dir(QPalette))
if hasattr(
QPalette, 'PlaceholderText'
): # pyqt5, pyside2, pyside6
default_palette.setColor(QPalette.PlaceholderText, color)
else: # pyqt6
default_palette.setColor(QPalette.ColorRole.Text, color)
QGuiApplication.setPalette(default_palette)
"
but there is no PlaceholderText in PyQt5/QtGui.pyi
So we need to distinguish PyQt5 another way
The text was updated successfully, but these errors were encountered:
`import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
from qt_material import apply_stylesheet
from qt_material import list_themes
def MyApp():
app = QApplication(sys.argv)
widget = QWidget()
textLabel = QLabel(widget)
textLabel.setText("Hello World!")
textLabel.move(150, 200)
widget.setGeometry(50, 50, 400, 400)
widget.setWindowTitle("PyQt5 Example")
list_themes()
apply_stylesheet(app, theme='dark_teal.xml')
widget.show()
sys.exit(app.exec_())
if name == 'main':
app = QApplication(sys.argv)
ex = MyApp()
sys.exit(app.exec_())`
AttributeError: type object 'ColorRole' has no attribute 'Text'
During handling of the above exception, another exception occurred:
File "D:\study\pyqt\test.py", line 18, in MyApp
apply_stylesheet(app, theme='dark_teal.xml')
File "D:\study\pyqt\test.py", line 25, in
ex = MyApp()
AttributeError: 'QPalette' object has no attribute 'set_color'
version is
qt-material 2.14
PyQt5 5.15.1
in init.py file
I see u define pyqt5 as this code
"
try:
print(dir(QPalette))
if hasattr(
QPalette, 'PlaceholderText'
): # pyqt5, pyside2, pyside6
default_palette.setColor(QPalette.PlaceholderText, color)
else: # pyqt6
default_palette.setColor(QPalette.ColorRole.Text, color)
QGuiApplication.setPalette(default_palette)
"
but there is no PlaceholderText in PyQt5/QtGui.pyi
So we need to distinguish PyQt5 another way
The text was updated successfully, but these errors were encountered: