문제

The code below works if I type it in just now opened python console, but not if I run it from file (there are no other code in this file)

import wnck
screen = wnck.screen_get_default()
wnck.window_get(58720313L).activate(9999999999)
도움이 되었습니까?

해결책

It's because there are events in the queue; the StackOverflow question python wnck not returning any data until after a pdb.set_trace() explains this. You just have to wait for the window list to fill up; when it is run fron the console, I believe Python empties the queue, but when you're running a file, you have to run the gtk iteration functions.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top