我刚开始使用PyGI(在ubuntunaty上),尽管我以前从未使用过pygtk。 不过,我在wxPython程序中使用了wnck,很容易就能得到当前打开的窗口的列表。在PyGI中,窗口列表总是空的。 相关码位:
from gi.repository import Gtk, Wnck
while Gtk.events_pending():
Gtk.main_iteration()
#... in my app class...
screen = Wnck.Screen.get_default()
wins = screen.get_windows()
就这样,wins == []
。
谢谢!在
在您的示例中,您必须使用:
Gtk.main_iteration_do(False)
而不是Gtk.main_iteration()
。在您需要在} 。不幸的是,文档缺少这一部分:(
screen.get_windows()
返回窗口列表之前调用^{相关问题 更多 >
编程相关推荐