-
-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The popup appears in the wrong place on first use #1691
Comments
I think it is because of popup window does not know where the Check the dirty rendering code below for troubleshoot: import dearpygui.dearpygui as dpg
dpg.create_context()
def call_me(s, a, u):
print("call me")
with dpg.window(tag = "Primary") as primary:
with dpg.child_window(tag = "Test", border = False):
with dpg.tab_bar(label = "tabbar"):
# First tab
with dpg.tab(label = "tab1", tag = "tab1"):
dpg.add_text("Tab!", tag="test")
dpg.create_viewport(title = "New GUI", width = 1000, height = 800)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.set_primary_window("Primary", True)
#dpg.start_dearpygui()
count = 1
while dpg.is_dearpygui_running():
dpg.render_dearpygui_frame()
if count == 1:
with dpg.popup("tab1", mousebutton = dpg.mvMouseButton_Right):
dpg.add_button(label = "close", width = -1, callback = call_me)
count += 1
dpg.destroy_context() |
I also found if you place the pop up code after import dearpygui.dearpygui as dpg
dpg.create_context()
with dpg.window(tag = "Primary") as primary:
with dpg.child_window(tag = "Test", border = False):
with dpg.tab_bar(label = "tabbar"):
# First tab
with dpg.tab(label = "tab1", tag = "tab1"):
dpg.add_text("Tab!")
# Second tab without width = -1 argument for the child button
with dpg.tab(label = "tab2", tag = "tab2", show = True):
dpg.add_text("Tab 2!")
dpg.create_viewport(title = "New GUI", width = 1000, height = 800)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.set_primary_window("Primary", True)
with dpg.popup("tab1", mousebutton = dpg.mvMouseButton_Right):
dpg.add_button(label = "close", width = -1, callback = lambda: dpg.delete_item("tab1"))
with dpg.popup("tab2", mousebutton = dpg.mvMouseButton_Right):
dpg.add_button(label = "close", callback = lambda: dpg.delete_item("tab2"))
dpg.start_dearpygui()
dpg.destroy_context() |
I'm also having this issue - using DPG 1.7.3. It seems to only happen to items+popups that were created before the app launches (i.e. created before dpg.start_dearpygui() is called). |
Looks like it's something in |
Look ma! static PyObject*
set_primary_window(PyObject* self, PyObject* args, PyObject* kwargs)
{
<...>
// reset other windows
for (auto& window : GContext->itemRegistry->windowRoots)
{
if (window->uuid != item)
{
<...>
window->info.dirtyPos = true;
}
}
|
Version of Dear PyGui
Version: 1.5.1
Operating System: Manjaro Linux (x86_64)
My Issue/Question
The popup appears in the corner of the primary window (pos [0, 0]) and expands (
width = -1
argument for the child button) on first use.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The popup should appear under the mouse position from the tab widget's hitbox with the correct size on every use.
Screenshots/Video
popup.mp4
Standalone, minimal, complete and verifiable example
The text was updated successfully, but these errors were encountered: