You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For fun, and to have a template, I have been trying to write a minimal docking example using hello_imgui and immapp. Here is what I came up with. Can this get even more minimal/shorter (just to show two empty panels)?
Code:
fromimgui_bundleimportimgui, immapp, hello_imguiclassAppState:
var0: str="Var0"var1: str="Var1"defgui_left(state: AppState):
imgui.button('A')
defgui_main(state: AppState):
imgui.button('B')
defmain():
# Default settings and callbacks, geometry, ini file name, # and allow dragging panels outside main window run_params=hello_imgui.RunnerParams()
run_params.app_window_params.window_title="minimal_docking"run_params.app_window_params.window_geometry.size= (800, 500)
run_params.imgui_window_params.enable_viewports=True# Tell HelloImGui we want a dock space (strictly required)run_params.imgui_window_params.default_imgui_window_type= (
hello_imgui.DefaultImGuiWindowType.provide_full_screen_dock_space
)
# Don't know what this does#run_params.docking_params.layout_condition = hello_imgui.DockingLayoutCondition.application_start # Create vertical split (Note that "MainDockSpace" is provided by default)run_params.docking_params.docking_splits= [
hello_imgui.DockingSplit(
initial_dock_="MainDockSpace",
new_dock_="LeftSpace",
direction_=imgui.Dir_.left,
ratio_=0.25,
)
]
# Define the application statestate=AppState()
run_params.docking_params.dockable_windows= [
hello_imgui.DockableWindow(
label_="Main",
dock_space_name_="MainDockSpace",
gui_function_=lambda: gui_main(state),
),
hello_imgui.DockableWindow(
label_="Left",
dock_space_name_="LeftSpace",
gui_function_=lambda: gui_left(state),
),
]
# Run the appaddons_params=immapp.AddOnsParams()
#addons_params.with_implot = Trueimmapp.run(run_params, addons_params)
if__name__=="__main__":
main()
The text was updated successfully, but these errors were encountered:
pthom
added
the
faq
A frequent issue, remaining opened to facilitate discoverability
label
Oct 22, 2024
Thank you for your post. Your code is quite good, and close to the minimal setup if we want it to be a good template starting point. Removing code would make it less extensible and/or less usable as a starting point.
Now, to address the question in the code: "what does run_params.docking_params.layout_condition stand for?": by default, if you do rearrange the docks when the app is running the modified layout is preserved when restarting the app.
If you want to always restore the default layout upon restarting, uncomment this line:
For fun, and to have a template, I have been trying to write a minimal docking example using hello_imgui and immapp. Here is what I came up with. Can this get even more minimal/shorter (just to show two empty panels)?
Code:
The text was updated successfully, but these errors were encountered: