Live data from Hacker News

DearPyGui

github.com

11–20 of 72 posts

Re: DearPyGui

#11

I can't find a clear explanation of "immediate mode" GUI creation (which this library enables) but it appears to be the sort of paradigm that pre-dated object-oriented and event-driven interaction handling that became the norm in the mid 90s (especially after the popularising of dev tools from Borland and Microsoft eg. Visual Basic etc), so I guess it is a formalisation of the procedural (?) methods from the era prec…

I haven't watched it in a long time, but I recall this as a useful video about it: https://www.youtube.com/watch?v=Z1qyvQsjK5Y

Re: DearPyGui

#12

I can't find a clear explanation of "immediate mode" GUI creation (which this library enables) but it appears to be the sort of paradigm that pre-dated object-oriented and event-driven interaction handling that became the norm in the mid 90s (especially after the popularising of dev tools from Borland and Microsoft eg. Visual Basic etc), so I guess it is a formalisation of the procedural (?) methods from the era prec…

Immediate Mode GUIs are just GUIs that are instanced and drawn immediately during a single frame. There's no need to persist any object or structure because the whole screen will be cleaned and redrawn in the next frame. Immediate mode is popular in video games because in most games the screen is re-rendered on each frame.

This is in opposition from retained-mode, where things are re-rendered only when necessary, like in Win32/Cocoa or the HTML DOM. With those, you need to keep an object in memory.

The nature of the job is what allows for very simple procedure calls that looks almost declarative. Here's an example (it's Unity3D btw):

    GUI.Label (new Rect (25, 25, 100, 30), "Label");
    if (GUI.Button (new Rect (25, 25, 100, 30), "Button")) {
      // This code is executed when the Button is clicked
    }

Re: DearPyGui

#13
post #2

How is it different from https://flutter.dev/desktop

You can probably do the same things with both, but Flutter is more geared toward applications, where Dear ImGui is more about putting GUIs in places where the GUI is secondary, such as games, creative tools and other graphic-heavy apps.

Here's what Dear ImGui's readme [1] says:

> Dear ImGui is designed to enable fast iterations and to empower programmers to create content creation tools and visualization / debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal, and lacks certain features normally found in more high-level libraries.

> Dear ImGui is particularly suited to integration in games engine (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on consoles platforms where operating system features are non-standard.

Basically: I wouldn't put Flutter inside a graphics heavy video game. I also wouldn't use ImGui for a social mobile app, or something like a business app that requires accessibility.

[1] https://github.com/ocornut/imgui

Re: DearPyGui

#14
post #12

I can't find a clear explanation of "immediate mode" GUI creation (which this library enables) but it appears to be the sort of paradigm that pre-dated object-oriented and event-driven interaction handling that became the norm in the mid 90s (especially after the popularising of dev tools from Borland and Microsoft eg. Visual Basic etc), so I guess it is a formalisation of the procedural (?) methods from the era prec…

Immediate Mode GUIs are just GUIs that are instanced and drawn immediately during a single frame. There's no need to persist any object or structure because the whole screen will be cleaned and redrawn in the next frame. Immediate mode is popular in video games because in most games the screen is re-rendered on each frame. This is in opposition from retained-mode, where things are re-rendered only when necessary, lik…

> Immediate mode is popular in video games because in most games the screen is re-rendered on each frame.

That makes no sense though because while you still need to re-render each frame, you do not necessarily have to waste rendering time on GUI each frame when GUIs are mostly static, why not just render the interface to a framebuffer and then simply draw that when composing a frame and only re-draw the framebuffer when the GUI changed/played an animation frame?

Re: DearPyGui

#15

I can't find a clear explanation of "immediate mode" GUI creation (which this library enables) but it appears to be the sort of paradigm that pre-dated object-oriented and event-driven interaction handling that became the norm in the mid 90s (especially after the popularising of dev tools from Borland and Microsoft eg. Visual Basic etc), so I guess it is a formalisation of the procedural (?) methods from the era prec…

This library has functions such as add_button() that can be used to create a hierarchy of widgets. From this, I suspect that the library is not fully operating in immediate mode, but perhaps it uses some kind of mixed mode?

Re: DearPyGui

#17
post #7

I'm curious if this is comparable to some of the other Python-based GUI frameworks out there: Tkinter, PyQT, Kivy, Toga.

Those libraries use retained-mode, which is the complete opposite of immediate-mode that Dear ImGui uses.

So they're geared towards different things. I posted an explanation here about the difference between retained and immediate mode: https://news.ycombinator.com/item?id=24318437

Re: DearPyGui

#18
post #14
post #12

Earlier quoted context omitted.

Immediate Mode GUIs are just GUIs that are instanced and drawn immediately during a single frame. There's no need to persist any object or structure because the whole screen will be cleaned and redrawn in the next frame. Immediate mode is popular in video games because in most games the screen is re-rendered on each frame. This is in opposition from retained-mode, where things are re-rendered only when necessary, lik…

> Immediate mode is popular in video games because in most games the screen is re-rendered on each frame. That makes no sense though because while you still need to re-render each frame, you do not necessarily have to waste rendering time on GUI each frame when GUIs are mostly static, why not just render the interface to a framebuffer and then simply draw that when composing a frame and only re-draw the framebuffer w…

I have my hands on a moderately complex ImGUI project right now and the entire thing is basically a few thousand polys in a handful of drawcalls. For a GUI that doesn't cover the entire viewport I'd wager that your approach would actually be slower, because (1) change detection is CPU-side and non-trivial (2) rasterizing and shading this little each frame is probably less expensive than blending with a viewport-sized buffer.

In games ImGUI is usually used for debugging purposes and I don't think in that usage you have many frames where nothing would change (e.g. if you are looking at scene-graph nodes their properties will probably constantly change due to things like idle animations, camera movements, scripting, ...)

Re: DearPyGui

#19
post #2

How is it different from https://flutter.dev/desktop

The main difference is that you can put dear imgui in your rendering pipeline and manually trigger it each frame. This fine grained control lets you use it on top of your graphical application as a HUD. Example:

    build_game_frame()
    render_game()
    build_hud_frame()
    render_dearpygui_frame()
    gl_flip()

Re: DearPyGui

#20
post #4

Earlier quoted context omitted.

How is it not? Flutter is Flutter, DearPyGui is Python binding for ImGui.

I read the question as asking about the differences (advantages and disadvantages) of the two

This is correct
Post reply on HN