Skip to content
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

Ability to hide viewport #2377

Open
Vazgen005 opened this issue Aug 11, 2024 · 2 comments
Open

Ability to hide viewport #2377

Vazgen005 opened this issue Aug 11, 2024 · 2 comments
Labels
state: pending not addressed yet

Comments

@Vazgen005
Copy link

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 Vazgen005 added the state: pending not addressed yet label Aug 11, 2024
@KyleTheScientist
Copy link

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)

@Vazgen005
Copy link
Author

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 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: pending not addressed yet
Projects
None yet
Development

No branches or pull requests

2 participants