Example #1
0
    window.set_fixed_size((width, height))

    # attach a vertical scroll panel
    vscroll = VScrollPanel(window)
    vscroll.set_fixed_size((width, height))

    # vscroll should only have *ONE* child. this is what `wrapper` is for
    wrapper = Widget(vscroll)
    wrapper.set_fixed_size((width, height))
    wrapper.set_layout(GridLayout())  # defaults: 2 columns

    # NOTE: don't __dict__ crawl in real code!
    # this is just because it's more convenient to do this for enumerating all
    # of the icons -- see cpp example for alternative...
    for key in entypo.__dict__.keys():
        if key.startswith("ICON_"):
            b = Button(wrapper, "entypo.{0}".format(key), entypo.__dict__[key])
            b.set_icon_position(Button.IconPosition.Left)
            b.set_fixed_width(half_width)

    screen.perform_layout()
    screen.draw_all()
    screen.set_visible(True)

    nanogui.mainloop()

    del screen
    gc.collect()

    nanogui.shutdown()