def shoot(self, x, y): # When we click, we know that the next screencap will have our mouse position over the target, and so will be invalid. # As a result, we put the cursor position somewhere else and skip to the next frame click(x, y) self.gg2window.dirty_frame_start() win32api.SetCursorPos([x, y - 50]) time.sleep(0.05) self.gg2window.dirty_frame_end() # now the dirty frame has passed. Give the computer some time to generate a new frame. time.sleep(0.05)
def Spider(url, idx, cnt1, cnt2, sheet1, sheet2): html = requests.get(url) selector = etree.HTML(html.text) title = getTitle(selector) #print title imgs = getImages(selector) #print imgs price, begin = getPriceAndBegin(selector) #print price, begin color = getColor(selector) #print color size, prices = getSize(selector) #print size, prices length = '10' height = '10' width = '10' weight, freight = click(url) if len(color) and len(size): for c in color: id = 0 for s in size: remark = c + '-' + s sheet2.write(cnt2, 0, idx + '-' + remark) sheet2.write(cnt2, 1, title + '-' + remark) writeSheet(sheet2, imgs, url, s, c, weight, length, width, height, begin, str(float(prices[id]) + float(freight)), cnt2) sheet2.write(cnt2, 12, remark) cnt2 = cnt2 + 1 id = id + 1 elif len(color): for c in color: remark = c sheet2.write(cnt2, 0, idx + '-' + remark) sheet2.write(cnt2, 1, title + '-' + remark) writeSheet(sheet2, imgs, url, '', c, weight, length, width, height, begin, str(float(price) + float(freight)), cnt2) sheet2.write(cnt2, 12, remark) cnt2 = cnt2 + 1 elif len(size): id = 0 for s in size: remark = s sheet2.write(cnt2, 0, idx + '-' + remark) sheet2.write(cnt2, 1, title + '-' + remark) writeSheet(sheet2, imgs, url, s, '', weight, length, width, height, begin, str(float(prices[id]) + float(freight)), cnt2) sheet2.write(cnt2, 12, remark) cnt2 = cnt2 + 1 id = id + 1 else: sheet1.write(cnt1, 0, idx) sheet1.write(cnt1, 1, title) writeSheet(sheet1, imgs, url, '', '', weight, length, width, height, begin, str(float(price) + float(freight)), cnt1) cnt1 = cnt1 + 1 return cnt1, cnt2
def do_close(): click.click(1)
def do_open(): click.click(2)
#!/usr/bin/env python __author__ = 'tclh123' import click import time import os if __name__ == "__main__": # os.system("screencapture -x -r -R410,50,18,18 foo2.png") time.sleep(2) click.click("test")
def work(): """ 使用说明: 左边是小号,用chrome 右边是大号,用IE 都全屏。 """ time.sleep(3) click.click("searchbox") keyboard.type(config.roomid) time.sleep(1) click.click("searchbutton") time.sleep(1) click.click("searchbutton") time.sleep(1) click.click("enterroom") time.sleep(1) keyboard.type(config.passwd) time.sleep(1) click.click("enterbutton") time.sleep(1) click.click("ready") keyboard.switchUser("right") click.click("ready") keyboard.switchUser("left") time.sleep(2) click.click("trust") keyboard.switchUser("right") time.sleep(1) click.click("trust") time.sleep(15) click.click("trust") cnt = 10 while cnt>0: cnt-=1 time.sleep(5) click.click_till("yes", 1) click.click_till("no", 1) click.click_till("end", 1) click.click("card1") time.sleep(1) click.click("card2") time.sleep(1) click.click("card3") time.sleep(1) click.click_till("yes", 1) pass keyboard.switchUser("left") time.sleep(2) click.click("run") click.click("sure_run") time.sleep(1) keyboard.switchUser("right") time.sleep(1) click.click("sure") keyboard.switchUser("left") time.sleep(2)
import click, keyboard, pyautogui, time time.sleep(2) while not keyboard.is_pressed("q"): click.click(205, 394) if keyboard.is_pressed("e"): time.sleep(15)
'Imprint MT Shadow', 11, ), text="RAD", command=lambda: ('deg(')).grid(row=1, column=0) DEG = Button(cal, padx=6, bd=0, fg='black', font=( 'Imprint MT Shadow', 11, ), text="DEG", command=lambda: c.click('rad(')).grid(row=1, column=1) SQROOT = Button(cal, padx=6, bd=0, fg='black', font=( 'Imprint MT Shadow', 11, ), text="√", command=lambda: c.click('sqroot(')).grid(row=1, column=2) CUBEROOT = Button(cal, padx=6, bd=0,
def iniciarjogo(): click(773, 592)
def jogarnovamente(): click(771, 714)
# music module pygame.mixer.music.load('../media/music/bensound-slowmotion.mp3') pygame.mixer.music.play(-1) # game start module gamestart() # MAIN MENU mainmenu() while True: process() click() SCREEN.blit(BACKGROUND, (0, 0)) SCREEN.blit(text, (260, 20)) # file usage f = open('../data_files/money.txt', 'r') for line in f: line = line[:-1] a = int(line) a += 1 f1 = open('../data_files/money.txt', 'w')