Tôi không có bất kỳ may mắn nào với các phương pháp trên, kết thúc bằng việc sử dụng win32 api trực tiếp, sử dụng bản hack cho phiên bản C here. Điều này phù hợp với tôi:
from win32gui import SetWindowPos
import win32con
SetWindowPos(window.winId(),
win32con.HWND_TOPMOST, # = always on top. only reliable way to bring it to the front on windows
0, 0, 0, 0,
win32con.SWP_NOMOVE | win32con.SWP_NOSIZE | win32con.SWP_SHOWWINDOW)
SetWindowPos(window.winId(),
win32con.HWND_NOTOPMOST, # disable the always on top, but leave window at its top position
0, 0, 0, 0,
win32con.SWP_NOMOVE | win32con.SWP_NOSIZE | win32con.SWP_SHOWWINDOW)
window.raise_()
window.show()
window.activateWindow()
Nguồn
2014-09-22 08:56:46
Cảm ơn rất nhiều. Nó hoạt động. – redice
Điều này không hoạt động đối với tôi nếu tôi đang chạy cửa sổ của mình từ thiết bị đầu cuối !!! –
Làm việc tốt dưới Ubuntu Unity! –