简体   繁体   中英

“Always on top” window in Kivy

Is there some possible way of setting kivy.Window to be always on the top of other windows. I mean something similar to tkinter.Tk().attributes('-topmost', True) . I have tried to set Window.on_hide = Window.raise_window but with no success.

I need to do this really badly so please write any even complicated solution Any help will be highly appreciated.

EDIT:

I am on Windows 10, python 3.6.5

Kivy doesn't have an API for this. It looks like SDL2, Kivy's main windowing backend, supports it only on X11 , so if that's your platform you could add the functionality. There might be way to do it using a platform-specific method outside of Kivy itself, but I don't know about that.

您可能可以使用 win32 python 模块(win32api、win32gui、winxpgui...)来获取窗口句柄(例如: win32gui.FindWindow(None, NAME) )然后设置其属性以将其粘贴在顶部,使用 win32gui.SetWindowPos 应该可以技巧,这里是相关文档: https : //msdn.microsoft.com/en-us/library/windows/desktop/ms633545(v=vs.85).aspx

This question had already answered years ago, but I want to recommend you to use just Python library.

And I strongly recommends you KivyOnTop . This is very simple and works well.

You can active AlwaysOnTop mode with register_topmost(Window, TITLE) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM