Title: Keep an analog clock on top of all other windows in tkinter and Python
One problem with previous posts such as Make a moveable shaped analog clock in tkinter and Python is that the clock doesn't appear in the task bar. That means if you lose it, it's hard to find again. One way to do that is to use Win+D to minimize all windows and then restore any window. The clock comes back when you restore that window, so you can either find it or move that window to find it. (Of course, this only works in Windows. I don't know what your options are in Linux or macOS.)
Another approach is to make the window topmost so it always appears above all other windows. Fortunately, this is easy: simply set the window's topmost property as in this code.
self.window.wm_attributes('-topmost', True)
That makes the window stay above all other windows. It also prevents Win+D from minimizing the window (in Windows, at least).
Large topmost windows can be pretty annoying, but you can probably get away with it for a small clock or other window that you will use often. (If I was planning to use this clock regularly, I would make it smaller so it doesn't cover as much of the desktop.)
Download the example to experiment with it and to see additional details.
|