Skip to content

@Figure.add_gui and append_gui decorators#849

Open
kushalkolar wants to merge 10 commits into
mainfrom
imgui-decs
Open

@Figure.add_gui and append_gui decorators#849
kushalkolar wants to merge 10 commits into
mainfrom
imgui-decs

Conversation

@kushalkolar

@kushalkolar kushalkolar commented Jun 1, 2025

Copy link
Copy Markdown
Member

closes #848

@kushalkolar kushalkolar requested a review from clewis7 as a code owner June 1, 2025 00:20
Comment thread examples/guis/imgui_decorator.py Outdated
@clewis7

clewis7 commented Jun 2, 2025

Copy link
Copy Markdown
Member

I have never seen someone love a decorator more than you lol

@clewis7

clewis7 commented Jun 2, 2025

Copy link
Copy Markdown
Member

I think this is pretty cool

One thing, I'm not sure how I feel about the ChangeFlag class

It seems like a lot of scaffolding just to indicate that the user has interacted with the imgui window...unless I am missing something

@kushalkolar

kushalkolar commented Jun 2, 2025

Copy link
Copy Markdown
Member Author

One thing, I'm not sure how I feel about the ChangeFlag class

It seems like a lot of scaffolding just to indicate that the user has interacted with the imgui window...unless I am missing something

It's useful when you have a lot of UI elements that could have changed and you want to know if any of them have changed. It's cumbersome to write:

changed1, val1 = imgui.slider(...)
changed2, val2 = imgui.slider(...)
...
changed_n, valn = imgui.slider(...)

if any([changed1, changed2, ... change_d]):
  # recompute

# could also do
if changed1 | changed2 | ... changed_n:
  # recompute

Basically the following is invalid python syntax otherwise I would just use the or operator | with tuple unpacking:

changed |, val1 = imgui.slider(...)
changed |, val2 = imgui.slider(...)
...
changed |, val_n = imgui.slider(...)

This is valid without tuple unpacking:

changed = func()
changed |= func2()

@kushalkolar kushalkolar mentioned this pull request Jun 5, 2025
14 tasks
@kushalkolar kushalkolar changed the title more imgui stuff! @Figure.add_gui and append_gui decorators Jun 29, 2025
@kushalkolar

Copy link
Copy Markdown
Member Author

Failures are due to an imgui update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create imgui edge windows without declaring a class

2 participants