hoffstadt / hoffstadt/DearPyGui
Programmatic API to trigger when wait_for_input=True
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
**Use Case:**
When the app is configured with,
dpg.configure_app(wait_for_input=True)
Provide an API so that the condition of user input can be simulated (or otherwise "triggered").
**Describe the solution you'd like**
Possible examples of the API call could be,
dpg.configure_app(input_now=True)
dpg.wait_for_input_trigger()
**Describe alternatives you've considered**
As a workaround, I am using the `pynput` module and simulating mouse activity,
from pynput.mouse import Controller
mouse = Controller()
mouse.move(0, 0)
And this works for me. Tested on RPi (DietPi 8), Linux (Ubuntu 22) and Windows 10.
**Additional context**
Why am I using `wait_for_input` in the first place? I don't know why `wait_for_input` feature is present, and perhaps my use case is different than the intended purpose, so its worth describing my use case. I am plotting many many (>1M) data points on a plot, and what happens is the frame rate, initially at 60fps, drops to <20 fps as data points build up beyond >1M. For this application I am not interested in frame rate. The plotted data is essentially static, updated at 1Hz. When the frame rate drops the system becomes very slow and user interaction becomes very laggy and the GUI becomes unusable. And the poor PC fan runs high. By using the `wait_for_input` the processing is cut way back and the GUI remains responsive. But I needed a way to tell DPG that the plot data has been updated, so I create the fake mouse event.
In the larger picture, it might be better to have an API that allows certain widgets to be "recalculated" only when needed. In other words `wait_for_input` is applied per item (that has the capability) rather than globally. For example,
dpg.configure_item(tag="myplot", wait_for_input=True);
...
dog.set_value(tag="myplot", (updated_x, updated_y));
dpg.configure_item(tag="myplot", update=True);
It was mentioned on the discord channel that this idea could be extended do the node editor.
Contributor guide
Assessment
This issue has not been assessed yet.