Just on the off chance that really all you need is to iconify the window, look at the Tk ->iconify and ->deiconify methods for a window. This does what clicking on "_" does (minimize to task bar). This doesn't make icon disappear into the system tray, but often it is enough.