示例#1
0
def _Show_Img():
    global img_png
    global Img
    while True:
        #lock.acquire()
        os.system('adb shell screencap -p /sdcard/1.png')
        os.system('adb pull /sdcard/1.png ~/')
        print('已打开')
        time.sleep(0.1)

        Img = Image.open('/home/q/1.png')
        img_png = ImageTk.PhotoImage(Img)
        label_Img = tk.Label(window, image=img_png)
        label_Img.pack()
        tk.update()
        print('tk.update')
        #lock.release()
        time.sleep(5)

        os.system('adb shell screencap -p /sdcard/1.png')
        os.system('adb pull /sdcard/1.png ~/')

        time.sleep(0.1)

        Img = Image.open('/home/q/1.png')
        img_png = ImageTk.PhotoImage(Img)
        label_Img = tk.Label(window, image=img_png)
        label_Img.pack()
        tk.update()
示例#2
0
def green(a):
    canvas.create_oval(125, 50, 375, 300, fill="white")
    canvas.create_oval(125, 350, 375, 600, fill="white")
    canvas.create_oval(125, 650, 375, 900, fill="forestgreen")
    time.sleep(a)
    light = "green"
    ref.update({'Traffic_light': light})
    tk.update()
示例#3
0
def amber(a):
    canvas.create_oval(125, 50, 375, 300, fill="white")
    canvas.create_oval(125, 350, 375, 600, fill="yellow")
    canvas.create_oval(125, 650, 375, 900, fill="white")
    time.sleep(a)
    light = "yellow"
    ref.update({'Traffic_light': light})
    tk.update()
示例#4
0
 def save(self, child_name, content, tk):
     try:
         f = open(child_name + ".m4a", "wb")
         f.write(content)
         tk.update()
     except IOError:
         return self.IOError
     finally:
         if f:
             f.close()
         return self.SUCCESS
示例#5
0
def thread_function(g, a, b, c):
    tk = Tk()
    win = Canvas(tk, width=55, height=200)
    win.pack()
    win.create_oval(5, 5, 50, 50, fill=a)
    win.create_oval(5, 55, 50, 100, fill=b)
    win.create_oval(5, 105, 50, 150, fill=c)
    win.master.title("Lane1")

    wait = int(time.time() + int(g))
    while time.time() < wait:
        tk.update()
示例#6
0
 def get_list(self, page_nums, album_id, headers, tk):
     for i in range(0, math.ceil(page_nums/30)):
         url_list = "https://www.ximalaya.com/revision/play/album?albumId=" + album_id + "&pageNum=" + str(
             i + 1) + "&sort=-1&pageSize=30"
         tracks_audio_play = dict()
         response = requests.get(url_list, headers=headers)
         response = json.loads(response.content)
         for t in response["data"]["tracksAudioPlay"]:
             tracks_audio_play[str(t["index"])] = {"trackName": t["trackName"], "src": t["src"], "duration": t["duration"]}
             self.data_dic = dict(self.data_dic, **tracks_audio_play)
         tk.update()
         yield tracks_audio_play
示例#7
0
 def download(self, headers, path, child_name, src, tk):
     response = requests.get(src, headers=headers)
     data = dict()
     if response.status_code == 200:
         status = self.save(path + "\\" + self.del_title(child_name), response.content, tk)
         tk.update()
         data["child_name"] = child_name
         data["status"] = status
         return data
     else:
         data["child_name"] = child_name
         data["status"] = self.DOWNLOADError
         return data
示例#8
0
def pergType(peso):
    global nperg
    if (arquivoP['tipo'][arquivoP] == 'xa'):
        x + peso
    elif (arquivoP['tipo'][arquivoP] == 'ya'):
        y + peso
    elif (arquivoP['tipo'][arquivoP] == 'xa+ya'):
        y + peso
        x + peso
        tk.update()
        arquivoP += 1
        print(arquivoP)
        print("pergType CALLED")
示例#9
0
 def delete_img(self):
     global lmain
     a = self.choice.get()
     b = int(a)
     thumblist.pop(b)
     tkinter.update()
示例#10
0
    #   t1.start()
    #   t2.start()
    #   print ("creat threading.Thread")
    #   # 等待子进程执行完
    #   t1.join()
    #   t2.join()
    print("exit threading")
except:
    print("Error: 无法启动线程")

while True:
    #lock.acquire()
    os.system('adb shell screencap -p /sdcard/1.png')
    os.system('adb pull /sdcard/1.png ~/')
    print('已打开')
    time.sleep(0.1)

    Img = Image.open('/home/q/1.png')
    img_png = ImageTk.PhotoImage(Img)
    label_Img = tk.Label(window, image=img_png)
    label_Img.pack()
    #tk.update_idletasks()
    tk.update()
    print('tk.update')
    #lock.release()
    time.sleep(5)

# 运行整体窗口
#window.mainloop()
print("exit")
示例#11
0
    def draw(self):
        pos = self.canvas.coords(self.id)
        if (pos[0] + self.x >= 0 and pos[2] + self.x <= self.canvas_width):
            self.canvas.move(self.id, self.x, 0)
        #self.x = 0
    def turn_left(self, event):
        self.x = -4

    def turn_right(self, event):
        self.x = 4


tk = Tk()
tk.title("Game")
tk.resizable(0, 0)  #not resizable
tk.wm_attributes("-topmost", 1)  #at top
canvas = Canvas(tk, width=500, height=500, bd=0, highlightthickness=0)
canvas.pack()
tk.update()  #init

paddle = Paddle(canvas, 'blue')
ball = Ball(canvas, paddle, 'red')

while 1:
    if (ball.hit_bottom == False):
        ball.draw()
        paddle.draw()
    tk.update_idletasks()
    tk.update()
    time.sleep(0.01)