DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

set_viewport_decorated(False) does not work well with primary_window

Open DataExplorerUser opened this issue 3 years ago • 4 comments

Win 10, DPG 0.8.54

set_viewport_decorated(False) does not work well with primary_window. The code below results in the screenshot below. The primary window does not cover the entire viewport.

import dearpygui.dearpygui as dpg

dpg.setup_viewport()
dpg.set_viewport_height(400)
dpg.set_viewport_width(400)
dpg.set_viewport_decorated(False)

with dpg.window(label="tutorial") as main_window:
    dpg.add_button(label="Press me")
    dpg.add_text('............................................................................................................................................................')

dpg.set_primary_window(main_window, True)
dpg.start_dearpygui()

set_deco

DataExplorerUser avatar Jul 31 '21 15:07 DataExplorerUser

Fixed in next release.

hoffstadt avatar Jan 04 '22 03:01 hoffstadt

It is not fixed yet.

yayege avatar May 16 '22 18:05 yayege

Will recheck this!

hoffstadt avatar May 17 '22 12:05 hoffstadt

V 1.6.2 Fixed;

import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.create_viewport(title='Custom Title', width=400, height=400, decorated=False)
dpg.setup_dearpygui()


with dpg.window(label="tutorial") as main_window:
    dpg.add_button(label="Press me")
    dpg.add_text('............................................................................................................................................................')

dpg.set_primary_window(main_window, True)
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

Bug should be closed !

Mstpyt avatar Jul 11 '22 19:07 Mstpyt

There is still an issue with decorated=False and primary window on Windows 10 using DPG 1.8.0

import dearpygui.dearpygui as dpg
dpg.create_context()

with dpg.window() as primary_window:
    dpg.add_text("Hello World")

dpg.create_viewport(width=200, height=200, decorated=False, x_pos=500)
dpg.set_primary_window(primary_window, True)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

Screenshot 2022-11-29 152053

Notice the thin gray border on the top and left edges of the viewport - which is not present on the bottom and right edges.

If you remove dpg.set_primary_window then the borders of the window are rendered consistently.

image

my1e5 avatar Nov 29 '22 15:11 my1e5

Hey @my1e5

I can reproduce it and yes it isn't quite correct. Should be fixed in the next release.

Mstpyt avatar Nov 30 '22 11:11 Mstpyt

Btw that is how it looks now:

grafik

grafik

So also verified with my own and pilots project, and it looks good to me

Mstpyt avatar Nov 30 '22 11:11 Mstpyt

Not a big deal but I'd like to point out that the fix makes the if (viewport->decorated) condition useless:

			if (viewport->decorated)
			{
				GContext->viewport->clientHeight = cheight;
				GContext->viewport->clientWidth = cwidth;
			}
			else
			{
				GContext->viewport->clientHeight = cheight;
				GContext->viewport->clientWidth = cwidth;
			}

Since the if and else branches are identical, one could just get rid of the if statement.

v-ein avatar Jan 06 '23 13:01 v-ein

That is true ! Thanks for the hint !

Mstpyt avatar Jan 06 '23 13:01 Mstpyt