How to make python window run as “Always On Top”?

后端 未结 3 1097
粉色の甜心
粉色の甜心 2020-12-10 05:50

I am running a little program in python that launches a small window that needs to stay on top of all the other windows. I believe this is OS specific, how is it done in GNU

相关标签:
3条回答
  • 2020-12-10 06:12

    I was trying to figure out a similar issue and found this solution using the Pmw module

    http://www.java2s.com/Code/Python/GUI-Pmw/Showglobalmodaldialog.htm

    0 讨论(0)
  • 2020-12-10 06:16

    I really don't know much Python at all, but Googling "pygtk always on top" gave me this:

    http://www.mail-archive.com/pygtk@daa.com.au/msg01370.html

    The solution posted there was:

    transient.set_transient_for(main_window)
    

    You might also want to search things like "x11 always on top". The underlying concept seems to be that you're giving the window manager a "hint" that it should keep the window above the others. The window manager, however, has free reign and can do whatever it wants.

    I've also seen the concept of layers when using window managers like Fluxbox, so maybe there's a way to change the layer on which the window appears.

    0 讨论(0)
  • 2020-12-10 06:22

    The question is more like which windowing toolkit are you using ? PyGTK and similar educated googling gave me this:

    
    gtk.Window.set_keep_above
    

    As mentioned previously it is upto the window manager to respect this setting or not.

    Edited to include SDL specific stuff Pygame uses SDL to do display work and apprently does not play nice with Windowing toolkits. SDL Window can be put on top is discussed here.

    0 讨论(0)
提交回复
热议问题