8000 Merge pull request #147 from jakogut/xdamage-example-fixes · python-xlib/python-xlib@677f090 · GitHub
[go: up one dir, main page]

Skip to content

Commit 677f090

Browse files
Merge pull request #147 from jakogut/xdamage-example-fixes
Xdamage example fixes
2 parents a21842a + ff757be commit 677f090

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

examples/xdamage.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333

3434
from Xlib import display, X, threaded,Xutil
3535
import time
36-
import thread
36+
37+
try:
38+
import thread
39+
except ModuleNotFoundError:
40+
import _thread as thread
41+
3742
from Xlib.ext import damage
3843
from PIL import Image, ImageTk
3944
import traceback
@@ -53,8 +58,8 @@ def blink(display, win, gc, cols):
5358

5459
def get_image_from_win(win, pt_w, pt_h, pt_x=0, pt_y=0):
5560
try:
56-
raw = win.get_image(ptX,ptY, ptW,ptH, X.ZPixmap, 0xffffffff)
57-
image = Image.frombytes("RGB", (ptW, ptH), raw.data, "raw", "BGRX")
61+
raw = win.get_image(pt_x, pt_y, pt_w, pt_h, X.ZPixmap, 0xffffffff)
62+
image = Image.frombytes("RGB", (pt_w, pt_h), raw.data, "raw", "BGRX")
5863
return image
5964

6065
except Exception:

0 commit comments

Comments
 (0)
0