You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to make a viewport functionally invisible by removing the top bar, and scaling and moving it with the main window. I got the scaling to work, but it glitches out when I try to scale it.
import dearpygui.dearpygui as dpg
def save_callback():
print("Save Clicked")
def check_window_status(sender, app_data, user_data):
if not dpg.is_item_shown("Example Window"):
dpg.stop_dearpygui()
dpg.create_context()
with dpg.window(label="Example Window", tag="Example Window", on_close=check_window_status, pos=[0,0]):
dpg.add_text("Hello world")
dpg.add_button(label="Save", callback=save_callback)
dpg.add_input_text(label="string")
dpg.add_slider_float(label="float")
dpg.create_viewport(title='Minimal Viewport', decorated=False)
dpg.setup_dearpygui()
dpg.show_viewport()
while dpg.is_dearpygui_running() == True:
dpg.set_viewport_height(dpg.get_item_rect_size("Example Window")[1])
dpg.set_viewport_width(dpg.get_item_rect_size("Example Window")[0])
dpg.set_viewport_pos([dpg.get_item_pos("Example Window")[0]+dpg.get_viewport_pos()[0],dpg.get_item_pos("Example Window")[1]+dpg.get_viewport_pos()[1]])
'''
if dpg.get_item_pos("Example Window") != [0,0]:
dpg.set_item_pos("Example Window",[0,0])
'''
# Get the position of the window relative to the viewport
window_pos = dpg.get_item_pos("Example Window")
# Get the position of the viewport
viewport_pos = dpg.get_viewport_pos()
# Calculate the global position of the window
global_window_pos = (window_pos[0] + viewport_pos[0], window_pos[1] + viewport_pos[1])
print(f"Global Window Position: {global_window_pos}")
#print(dpg.get_item_pos("Example Window"))
#print(dpg.get_viewport_pos())
dpg.render_dearpygui_frame()
dpg.destroy_context()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to make a viewport functionally invisible by removing the top bar, and scaling and moving it with the main window. I got the scaling to work, but it glitches out when I try to scale it.
Beta Was this translation helpful? Give feedback.
All reactions