gtk: set active window

馋奶兔 提交于 2019-12-06 05:22:50

Ah thanks to this thread, the answer is to call gtk.Window.present().

if W is a gtk.Window:

import wnck
wnck.window_get(W.window.xid).activate()

Here's what worked for me (thanks Dan D for pointing out wnck)

def activate(window):
    screen = wnck.screen_get_default()
    screen.force_update()
    wnckwin = [win for win in screen.get_windows() if win.get_xid() == window.window.xid][0]
    wnckwin.activate(gtk.gdk.x11_get_server_time(window.window))

You can also use gtk.Dialog.run (if it's a Dialog) aditional to gtk.Window.present

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!