Hi,

I've got a small program, that would be really useful if it could stay on top of other windows programs, i don't think there is a method for that in Tkinter,
if anyone has any experience or ideas on this topic, please let me know

thanks

There is a thing like that in Tkinter, observe ...

# to create additional windows, you can use Toplevel()
# when you quit the root window the child window also quits

from Tkinter import *
    
# create root window
root = Tk()
root.title('root win')
# create child window
top = Toplevel()
top.title('top win')
top.lift(aboveThis=root)
 
root.mainloop()

Hi a1eio,

So, you want this window to have an "always on top" quality to it, like you can do with Winamp, right? And you want the window to be not only on top of all the other Tkinter/WxPython/whatever windows, but on top of every running app window currently on your desktop, right?

Hrm, I don't know how to do that, and I'm not sure that vegaseat's code can provide a complete solution. This actually might even be an OS- or window manager-dependent thing (whether the OS/window manager allows programs to grab the "who gets to be on top" flag). I'll do some digging and try to get back to you this weekend, though.

thanks! i'm gonna try and look into it myself, but i've got deadlines on my back so i don't know if i'll get the time.

thanks again,
alex

Hi a1eio,

Are you using Windows? I think this problem has OS-specific solutions. If you are using Windows, you are in luck. Try:

from Tkinter import *
root = Tk()
root.wm_attributes("-topmost", 1)
root.mainloop()

There are other ways of doing it, at least some of which involve the win32gui module - try Googling for 'Tkinter Python "always on top"' and you'll see what I mean. Unfortunately, I can't find a cross-platform way of doing this in Tkinter, probably because the mechanisms which underlie interprocess communication (which is really what this is) are different on each platform.

Hope this is what you were looking for.

Comments
Awesome.

yes, thanks
it's just for a small app i'm runing on my computer at schol, which i doubt will ever change from windows, thanks for the help!!

hmm cant seem to get it working, it doesnt display anything at all...
EDIT: it works now, thanks again

Hi a1eio,

Just out of curiosity, what happens when you load another program with an "Always on Top" feature, set it to be always on top, and then run your Python program? I'm curious to see which one will win :cheesy:.

i'm guessing that it would go in the order of which was opened first, bit like a stack maybe, i dunno. but yea it's interesting, i havn't actually found a window which is always on top yet, but when i do i'll let you know

This question has already been answered. Start a new discussion instead.