DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Ability to hide viewport

Open Vazgen005 opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. I want my application to be able to minimize to the system tray using pystray library.

Describe the solution you'd like To do this, I need to hide the viewport in some way. It would be nice to have a function dpg.set_viewport_visible(bool)

Describe alternatives you've considered PySide6 has a .hide() method.

Vazgen005 avatar Aug 11 '24 17:08 Vazgen005

The application I was making a few weeks ago had a dependency on the AutoHotKey Python library, and that library has a window.hide() method that can hide arbitrary windows if you're looking for a workaround. There are probably simpler solutions, but since I already had the package imported it was easy to include. Something like this:

from ahk import AHK
from ahk.directives import NoTrayIcon

ahk = AHK(directives=[NoTrayIcon()])

... # Set up your window and such

# Fetch the window
title = dpg.get_viewport_title()
window = ahk.find_window_by_class(title)

# Hiding completely hides the window and the taskbar item, but it is still running.
dpg.add_button(label="Hide", callback=window.hide)
dpg.add_button(label="Show", callback=window.show)

KyleTheScientist avatar Aug 22 '24 14:08 KyleTheScientist

The application I was making a few weeks ago had a dependency on the AutoHotKey Python library, and that library has a window.hide() method that can hide arbitrary windows if you're looking for a workaround. There are probably simpler solutions, but since I already had the package imported it was easy to include. Something like this:

Thanks, I'll look into it. It's a pretty interesting solution, by the way 😁

Vazgen005 avatar Aug 22 '24 19:08 Vazgen005