Using window flags

New windows created using begin() function can be customized/tuned with additional flags argument. This argument is an integer bitfield so many different flags can be joined together with | operator.

Example:

imgui.set_next_window_size(300, 90)
imgui.set_next_window_position(10, 0)
imgui.begin(
    "Custom window",
    flags=imgui.WINDOW_MENU_BAR | imgui.WINDOW_SHOW_BORDERS
)
imgui.text("Custom window with menu bar and borders")
imgui.end()

imgui.set_next_window_size(300, 90)
imgui.set_next_window_position(10, 100)
imgui.begin("Default Window")
imgui.text("Default window with title bar")
imgui.end()

Outputs:

../_images/window_flags.png

Window flags are also available for new scrollable child regions created with begin_child() function.

Example:

imgui.begin("Scrollale regions with flags")

imgui.begin_child(
    "Child 1", height=70, border=True,
    flags=imgui.WINDOW_ALWAYS_HORIZONTAL_SCROLLBAR
)
imgui.text("inside region 1")
imgui.end_child()

imgui.begin_child(
    "Child 2", height=70, border=True,
    flags=imgui.WINDOW_ALWAYS_VERTICAL_SCROLLBAR
)
imgui.text("inside region 2")
imgui.end_child()

imgui.end()

Outputs:

../_images/child_region_flags.png

Note that in case of scrollable regions it is possible to override the border argument with the imgui.WINDOW_SHOW_BORDERS flag.

Example:

imgui.begin("Region border override")
imgui.begin_child(
    "Child region", border=False,
    flags=imgui.WINDOW_SHOW_BORDERS
)
imgui.end_child()
imgui.end()

Outputs:

../_images/child_region_flags_override_border.png

List of all available window flags (click to see documentation):