6
sys.path[1:1] = [os.path.join(sys.path[0], '..')]
8
from Xlib import display, X, threaded
14
win.fill_rectangle(gc, 20, 20, 60, 60)
16
def blink(display, win, gc, cols):
19
print 'Changing color', cols[0]
20
gc.change(foreground = cols[0])
21
cols = (cols[1], cols[0])
27
root = d.screen().root
29
colormap = d.screen().default_colormap
31
red = colormap.alloc_named_color("red").pixel
32
blue = colormap.alloc_named_color("blue").pixel
33
background = colormap.alloc_named_color("white").pixel
35
window = root.create_window(100, 100, 100, 100, 1,
36
X.CopyFromParent, X.InputOutput,
38
background_pixel = background,
39
event_mask = X.StructureNotifyMask | X.ExposureMask)
42
gc = window.create_gc(foreground = red)
44
thread.start_new_thread(blink, (d, window, gc, (blue, red)))
47
event = d.next_event()
48
if event.type == X.Expose:
51
elif event.type == X.DestroyNotify:
54
if __name__ == "__main__":