Skip to content

Commit 147973c

Browse files
author
Hart
committed
updated xlib wrapper and helloworld
1 parent 6b22aec commit 147973c

4 files changed

Lines changed: 440 additions & 48 deletions

File tree

examples/xlib-helloworld.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/python
2+
import os, sys, time, ctypes
3+
import xlib as X
4+
5+
display = X.OpenDisplay()
6+
print(display)
7+
screen = X.DefaultScreen( display )
8+
print(screen)
9+
10+
window = X.CreateSimpleWindow(
11+
display,
12+
X.RootWindow(display, screen),
13+
10, 10, 200, 200, 1,
14+
X.BlackPixel(display,screen),
15+
X.WhitePixel(display,screen),
16+
)
17+
print(window)
18+
19+
X.SelectInput( display, window, X.ExposureMask | X.KeyPressMask )
20+
21+
X.MapWindow( display, window )
22+
23+
event = X.Event()
24+
25+
while True:
26+
X.NextEvent( display, event )
27+
28+
X.FillRectangle(
29+
display, window, X.DefaultGC(display,screen),
30+
20, 20, 10, 10
31+
)
32+
33+
if event.type == X.KeyPress: # TODO fixme
34+
break
35+
36+
X.CloseDisplay( display )
37+
38+
print('test complete')
39+

0 commit comments

Comments
 (0)