1

Pressing command-H in OSX immediately hides the active window. How do I achieve the same effect, programmatically, from Python? Specifically, I'd like to find a particular window that my application creates and then be able to show & hide it programmatically.

I already know how to do this with pywin32 but I'm afraid my expertise there doesn't quite cover OSX as well.

If it helps, the window in question is one created by pygame. I know that pygame has pygame.display.iconify() but that doesn't satisfy my requirements - the window doesn't disappear immediately, but rather the disappearance is animated, and there's no corresponding "uniconify" function that I can find.

Rex Nihilo
  • 604
  • 2
  • 7
  • 16
Claudiu
  • 224,032
  • 165
  • 485
  • 680

1 Answers1

0

Well, this ended up working. When I want to hide the window, I do pygame.display.quit() and make my code properly handle not having a display. When I want to show it, I do pygame.display.set_mode(...) with the former resolution.

The net effect is that of hiding & showing the window. Unfortunately the window gets created in a different spot than where it started, and although apparently you can tell SDL to create the window in a particular spot, I haven't been able to find a way to get the window's location...

Claudiu
  • 224,032
  • 165
  • 485
  • 680