2016-03-04 52 views
0

我正在尝试使用enaml为我的应用程序创建视图。我想知道如何设置窗口小部件的背景颜色。我发现我可以使用样式表为窗口内的事物设置颜色,但我似乎无法找到设置窗口颜色的方法。如何设置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 

回答

0

你只需要样式正确的元素:

enamldef Main(MainWindow): 
    StyleSheet: 
     Style: 
      element = 'Main' 
      Setter: 
       field = 'background' 
       value = 'indianred' 
    Container: 
     PushButton: 
      text = "one" 

Example Screenshot