Python 如何在QlineEdit中更改单个字符串的颜色
我正在使用计算器,当我点击“+”按钮时,我希望“+”是绿色而不是白色,而不改变数字的白色 这是按钮“+”的代码: 为了使我的问题简单明了,我希望输出如下:Python 如何在QlineEdit中更改单个字符串的颜色,python,python-3.x,colors,pyqt5,qlineedit,Python,Python 3.x,Colors,Pyqt5,Qlineedit,我正在使用计算器,当我点击“+”按钮时,我希望“+”是绿色而不是白色,而不改变数字的白色 这是按钮“+”的代码: 为了使我的问题简单明了,我希望输出如下: 您可以尝试使用 splus.setStyleSheet("QLineEdit { background: rgb(xxx,xxx,xxx); selection- background-color: rgb(xxx,xxx,xxx); }") 将由QLineEdit的clicked事件激发为: splus.cli
您可以尝试使用
splus.setStyleSheet("QLineEdit { background: rgb(xxx,xxx,xxx); selection-
background-color: rgb(xxx,xxx,xxx); }")
将由QLineEdit的clicked事件激发为:
splus.clicked.connect(self.toggleColors)
希望它对您有用。您可以尝试使用
splus.setStyleSheet("QLineEdit { background: rgb(xxx,xxx,xxx); selection-
background-color: rgb(xxx,xxx,xxx); }")
将由QLineEdit的clicked事件激发为:
splus.clicked.connect(self.toggleColors)
希望对你有用