Hi Omar,
Is it possible that I can layout widgets such as Labels Buttons without a Window?
Thanks.
No, but you can make a window transparent (background alpha 0.0), no title bar, and not moveable and then lay them out there. However the empty space of that window will still catch clicks over what's behind it.
will it also catch the mouse if it is just readonly? like simple textoutput
Yes the window itself will catch the mouse (so you can bring to front, or move it).
Not trivial to do fully pass-through window at the moment (possible with some work).
maybe a simple window flag could solve this easily. the user can specify that a whole window is nonInteractive then?
Thank you all, get it.
Necro-resurrecting old topic for reference for people stumbling on this through searches.
ImGuiWindowFlags_NoInputs flag disable windows input and can be used for that if you don't intend to receive clicks, just display stuff.
ImDrawList api may also be used directly.
For people who are new to imgui and do stumble across threads like this through Google, it would be infinitely more helpful if you included examples of how to do what you suggest.
For example, how do I remove the titlebar from a window? How do I make a non-movable window?
How do I set the ImGuiWindowFlags_NoInputs flag? How do I set the background colour of a window?
It has been 5 years!
AND I DID google it!
AND this issue has been closed!
My response was to the maintainers of imgui. ;)
I came across this thread after searching for something similar, and would have appreciated examples of how to do what was suggested above. I figured it out in the end, but some things I tried along the way certainly didn't make sense when they didn't work. (Like background alpha not coming from the background colour, for example.)
Nowadays there are flags such as ImGuiWindowFlags_NoBackground and ImGuiWindowFlags_NoDecoration to do that (those flags needs to be passed to the Begin() function. As well as functions such as SetNextWindowBgAlpha() to specifically override the background alpha.
How can we do this with the python port of this amazing GUI (https://github.com/swistakm/pyimgui)? Ive been trying to figure out how to get free floating windows without a background for weeks already.
Basically I just want these two windows without and outside the black "background window" that wraps these two windows":
@chwba You can use the ImGuiWindowFlags_NoBackground flag or SetNextWindowBgAlpha(0.0f) before Begin(). Both will give that effect.
Yeah, I got that already, Im just not clear how or where to pass that.
They give this example:
https://github.com/swistakm/pyimgui/blob/master/doc/examples/integrations_glfw3.py
From where can I call SetNextWindowBgAlpha(0.0f), to which function can I pass ImGuiWindowFlags_NoBackground?
Window flags can be passed as the third parameter to imgui.begin.
Yeah I had figured that out, but it doesnt seem to work.
def begin(str_label, closable=False, ImGuiWindowFlags_flags=0): # real signature unknown; restored from __doc__
"""
begin(str label, closable=False, ImGuiWindowFlags flags=0)
Begin a window.
.. visual-example::
:auto_layout:
imgui.begin("Example: empty window")
imgui.end()
Args:
label (str): label of the window.
closable (bool): define if window is closable.
flags: Window flags. See:
:ref:`list of available flags <window-flag-options>`.
Returns:
tuple: ``(expanded, opened)`` tuple of bools. If window is collapsed
``expanded==True``. The value of ``opened`` is always True for
non-closable and open windows but changes state to False on close
button click for closable windows.
.. wraps::
Begin(
const char* name,
bool* p_open = NULL,
ImGuiWindowFlags flags = 0
)
"""
pass
This is the function from the python port in core.py
I tried multiple different combinations, such as
imgui.begin(str_label="Custom window", closable=True, ImGuiWindowFlags_flags=("ImGuiWindowFlags_NoBackground", 1))
or
imgui.begin(str_label="Custom window", closable=True, ImGuiWindowFlags_flags="ImGuiWindowFlags_NoBackground")
or
imgui.begin(str_label="Custom window", closable=True, ImGuiWindowFlags_flags="NoBackground")
All of them drop errors.
@chwba In pyimgui the flags are const values in the imgui module, so you would pass them like
imgui.begin("Window", True, imgui.WINDOW_NO_MOVE | imgui.WINDOW_NO_RESIZE)
if you wanted an immovable, non-resizeable window
from the looks of it there's no WINDOW_NO_BACKGROUND in pyimgui though, so instead you'd just do
imgui.set_next_window_bg_alpha(0.0)
imgui.begin("Window")
if you need a transparent background
Most helpful comment
Necro-resurrecting old topic for reference for people stumbling on this through searches.
ImGuiWindowFlags_NoInputsflag disable windows input and can be used for that if you don't intend to receive clicks, just display stuff.ImDrawList api may also be used directly.