2015-11-18 78 views
1

默认情况下,下面的代码将布局每个GroupBox对象垂直堆叠(一个在另一个之下)。Enaml Looper水平布局

enamldef Main(Window): 
    attr model 

    Container: 
     constraints = [ hbox(items) ] 

     Container: items: 
      Looper: 
       iterable << model.l    # model.l = some list of atom objects 
        GroupBox: 
         title << loop_item.name     
         CheckBox: 
          checked := loop_item.active 

我该如何将它们摆放在活套上,使它们水平堆叠(从左到右)呢?

我在enaml docs/API中找不到关于此的任何信息。

回答

1

您可以提供自己的约束你想要什么该做,比如横向盒帮手: https://github.com/nucleic/enaml/blob/master/examples/layout/basic/hbox.enaml#L34

或者使用的方便性容器的一个子类,如HGroup: https://github.com/nucleic/enaml/blob/master/examples/widgets/h_group.enaml#L46 https://github.com/nucleic/enaml/blob/master/enaml/widgets/h_group.py#L17

的Enaml的例子可能会回答你很多入门级的问题: https://github.com/nucleic/enaml/tree/master/examples