-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkailive-tk.py
49 lines (38 loc) · 1.05 KB
/
kailive-tk.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import threading
import time
import kaiscr
import sys,os
import tkinter
from PIL import Image
from PIL import ImageTk
from io import BytesIO
os.system('adb root && adb forward tcp:6000 localfilesystem:/data/local/debugger-socket')
root = tkinter.Tk()
root.title('KaiLive')
root.geometry('240x320')
cv = tkinter.Canvas(root, width=240, height=320, background='white')
cv.pack(fill=tkinter.BOTH, expand=tkinter.YES)
takescreenshot = kaiscr.TakeScreenshot()
screenshot = takescreenshot.screenshot
bye = takescreenshot.close
stop = False
def quit(*args):
global stop
stop = True
bye()
root.destroy()
root.protocol("WM_DELETE_WINDOW", quit)
def update_pic():
global cv,root
global takescreenshot
try:
while not stop:
png = screenshot()
im = Image.open(BytesIO(png))
img = ImageTk.PhotoImage(image=im )
cv.create_image(120, 160, image=img)
root.update()
#time.sleep(0)
except Exception as e:
print(e)
update_pic()