我试图使用enaml为我的应用程序创建视图。我想知道如何设置窗口小部件的背景色。我看到我可以使用样式表为窗口内的东西设置颜色,但我似乎找不到设置窗口颜色的方法。
enamldef Main(MainWindow):
StyleSheet:
Style:
element = 'PushButton'
Setter:
field = 'background'
value = 'indianred'
title << ""
initial_size = (1000,500)
initial_position = (300,150)
icon = loadIcon(normpath('TitleIcon.png'))
visible = True
always_on_top = True
style_class << "WindowStyle"
MyMenuBar:
pass
Container:
#constraints = [vbox(label, label, spacing=0)]
PushButton:
text = "one"
pass发布于 2016-03-06 19:03:21
您只需将正确的元素样式:
enamldef Main(MainWindow):
StyleSheet:
Style:
element = 'Main'
Setter:
field = 'background'
value = 'indianred'
Container:
PushButton:
text = "one"

https://stackoverflow.com/questions/35806361
复制相似问题