默认情况下,下面的代码将垂直地排列每个GroupBox对象(一个在另一个下面)。
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中找不到这方面的任何信息。
发布于 2015-11-18 23:42:46
您可以提供您自己的约束来执行您想做的事情,例如hbox助手:https://github.com/nucleic/enaml/blob/master/examples/layout/basic/hbox.enaml#L34
或者使用一个方便容器子类,如HGroup:group.enaml#L46 group.py#L17
Enaml示例可能会回答很多入门级的问题:https://github.com/nucleic/enaml/tree/master/examples。
https://stackoverflow.com/questions/33770561
复制相似问题