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()
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()
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()
List of all available window flags (click to see documentation):
imgui.WINDOW_NO_TITLE_BAR
imgui.WINDOW_NO_RESIZE
imgui.WINDOW_NO_MOVE
imgui.WINDOW_NO_SCROLLBAR
imgui.WINDOW_NO_SCROLL_WITH_MOUSE
imgui.WINDOW_NO_COLLAPSE
imgui.WINDOW_ALWAYS_AUTO_RESIZE
imgui.WINDOW_SHOW_BORDERS
imgui.WINDOW_NO_SAVED_SETTINGS
imgui.WINDOW_NO_INPUTS
imgui.WINDOW_MENU_BAR
imgui.WINDOW_HORIZONTAL_SCROLLING_BAR
imgui.WINDOW_NO_FOCUS_ON_APPEARING
imgui.WINDOW_NO_BRING_TO_FRONT_ON_FOCUS
imgui.WINDOW_ALWAYS_VERTICAL_SCROLLBAR
imgui.WINDOW_ALWAYS_HORIZONTAL_SCROLLBAR
imgui.WINDOW_ALWAYS_USE_WINDOW_PADDING