Version of Dear PyGui
Version: 1.7.1
Operating System: Windows 10 build 19044.2006
My Issue/Question
Item resize handler (mvAppItemType::mvResizeHandler) calls its callback function in realtime while increasing size of the viewport with primary window. When viewport (as well as primary window) size is decreased callback is called only if mouse button released or if size increased again. Both bind_item_handler_registry and set_viewport_resize_callback have this bug.
The same bug could be seen in this example if the window is set to primary.
Important note: if the window is not primary, than callback is called in realtime both while increasing and decreasing the window size. Therefore for not primary windows resize item handler works as expected.
To Reproduce
- Create viewport.
- Create window and set it primary.
- Define resize callback function with some obvious actions (e. g. print).
- Create item resize handler.
- Bind handler to window and function.
- Set viewport resize callback to defined function.
- Run the program and try to change window (not dpg, OS window -- viewport) size in horizontal and vertical directions or both.
- Take a look in terminal. Callback do its job only while stretching and only once while size reducing (only when button released or stretching occured).
Expected behavior
I expect exactly the same behaviour in both directions.
Screenshots/Video
Demonstration of this bug can be seen on this video. As can be seen on the video I've used code from example below simply pasted in IPython.
Standalone, minimal, complete and verifiable example
# Here's shortest example which I could make.
import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()
#Variable to show number of calls of the callback function below
i = 0
def resized():
global i
i += 1
print(f"Callback called {i} times.")
with dpg.window(tag="#main_window", label="tutorial"):
dpg.add_button(label="Press me")
dpg.set_primary_window("#main_window", True)
with dpg.item_handler_registry(tag="#resize_handler"):
dpg.add_item_resize_handler(callback=resized)
#Next two strings bind function resize to window and viewport resize events.
#Any of two may be commented as it will not affect on the bug
dpg.bind_item_handler_registry("#main_window", "#resize_handler")
dpg.set_viewport_resize_callback(resized)
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
Version of Dear PyGui
Version: 1.7.1
Operating System: Windows 10 build 19044.2006
My Issue/Question
Item resize handler (
mvAppItemType::mvResizeHandler) calls its callback function in realtime while increasing size of the viewport with primary window. When viewport (as well as primary window) size is decreased callback is called only if mouse button released or if size increased again. Bothbind_item_handler_registryandset_viewport_resize_callbackhave this bug.The same bug could be seen in this example if the window is set to primary.
Important note: if the window is not primary, than callback is called in realtime both while increasing and decreasing the window size. Therefore for not primary windows resize item handler works as expected.
To Reproduce
Expected behavior
I expect exactly the same behaviour in both directions.
Screenshots/Video
Demonstration of this bug can be seen on this video. As can be seen on the video I've used code from example below simply pasted in IPython.
Standalone, minimal, complete and verifiable example