some problem about Pyside2 set button color

   6395   3   0
User Avatar
Member
8 posts
Joined: Sept. 2017
Offline
Hi everyone, i have a question about set button color in houdini 16.5 by pyside2
this my code
from PySide2.QtWidgets import *
from PySide2.QtCore import *
from PySide2.QtGui import *


class Color_Lab(QWidget):
def __init__(self):
super(Color_Lab,self).__init__()
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.setWindowTitle(“Node_Color”)
self.setGeometry(100,100,1000,200)




Box = QHBoxLayout()
self.setLayout(Box)
add_button_css = “QPushButton{font-size: 10px; font-family: Arial;background-color:black}”
add_button = QPushButton('a')
#c=add_button.palette()
#col=QColor(0,50,50)
#c.setColor(QPalette.Button,col)
#add_button.setPalette©
add_button.setFixedWidth( 110 )
Box.addWidget(add_button)
#self.setStyleSheet(“background-color:rgb(0,0,0)”)
add_button.setStyleSheet(“background-color:red”)
Main=Color_Lab()
Main.show()



A big problem confuse me, Nothing is changed. I don't know what’happen,Does anyone know a answer. please help. Because in other version it can work.
User Avatar
Member
36 posts
Joined: May 2013
Offline
It works for me. Houdini fx 16.0.736

Edited by claudiohick - July 5, 2018 15:12:26
User Avatar
Member
8 posts
Joined: Sept. 2017
Offline
claudiohick
It works for me. Houdini fx 16.0.736


Thanks your test

For my houdini isn't running right my houdini is 16.5, I don't know why

Attachments:
QQ图片20180708000635.png (55.5 KB)

User Avatar
Member
8 posts
Joined: Sept. 2017
Offline
QPushButton and QLineEdit isn't work right.
  • Quick Links