开发者

How to keep a python window on top of all others (python 3.1)

开发者 https://www.devze.com 2023-01-20 11:48 出处:网络
I\'m writing a little program that basically has a bunch of buttons that when you click one, it inputs a certa开发者_如何学Goin line of text into an online game I play. It would be a lot easier to use

I'm writing a little program that basically has a bunch of buttons that when you click one, it inputs a certa开发者_如何学Goin line of text into an online game I play. It would be a lot easier to use if the GUI would stay on top of the active game window so the user could be playing and then press a button on the panel without having to bring it to the front first.

Any help on how to do this would be great. Thanks

EDIT: Using tkinter


You will need to provide the information on which GUI framework you are using for detailed answer at SO.

On windows you could do something like this with the handle of your window.

import win32gui
import win32con
win32gui.SetWindowPos(hWnd, win32con.HWND_TOPMOST, 0,0,0,0,
win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)

Also with Tkinter, you might want to try. I have not tried it though.

root = Tk()
root.wm_attributes("-topmost", 1)
0

精彩评论

暂无评论...
验证码 换一张
取 消