def temp(): pyautogui.alert('This displays some text with an OK button.') pyautogui.position() # current mouse x and y pyautogui.onScreen(x, y) # True if x & y are within the screen. pyautogui.PAUSE = 2.5 # Pause 2.5 s pyautogui.dragTo(x, y, duration=num_seconds) # drag mouse to XY pyautogui.dragRel(xOffset, yOffset, duration=num_seconds) # drag mouse relative to its current position pyautogui.click(x=moveToX, y=moveToY, clicks=num_of_clicks, interval=secs_between_clicks, button='left') # The button keyword argument can be 'left', 'middle', or 'right'. pyautogui.scroll(amount_to_scroll, x=moveToX, y=moveToY) pyautogui.mouseDown(x=moveToX, y=moveToY, button='left') pyautogui.mouseUp(x=moveToX, y=moveToY, button='left') pyautogui.typewrite('Hello world!\n', interval=secs_between_keys) # useful for entering text, newline is Enter pyautogui.typewrite(['a', 'b', 'c', 'left', 'backspace', 'enter', 'f1'], interval=secs_between_keys) pyautogui.hotkey('ctrl', 'c') # ctrl-c to copy pyautogui.hotkey('ctrl', 'v') # ctrl-v to paste pyautogui.alert('This displays some text with an OK button.') pyautogui.confirm('This displays text and has an OK and Cancel button.') pyautogui.prompt('This lets the user type in a string and press OK.') pyautogui.screenshot('foo.png') # returns a Pillow/PIL Image object, and saves it to a file pyautogui.locateOnScreen('looksLikeThis.png') pyautogui.locateCenterOnScreen('looksLikeThis.png') # returns center x and y
import time import random import pyautogui def move_mouse(how_long_in_seconds): start_time = time.time() time_elapsed = time.time() - start_time xsize, ysize = pyautogui.size() while time_elapsed < how_long_in_seconds: x, y = random.randrange(xsize), random.randrange(ysize) pyautogui.moveTo(x, y, duration=0.2) time_elapsed = time.time() - start_time if __name__ == "__main__": pyautogui.alert("Your Java update is now complete") move_mouse(120)
def start(self): if self.deselected_screenshot is None: pyautogui.alert( text='You need to set a constant screenshot.', title='Screenshot', button='OK') return self.start_button.config(text='Stop', command=self.stop) self.server.start()
def dumper(): pya.click(100, 500) pya.hotkey('alt', 'd') pya.press('enter') pya.hotkey('alt', 'd') mrn = pyperclip.copy('empty') pya.hotkey('ctrl', 'c') mrn = pyperclip.paste() print(mrn) today_path = write_as_billed(mrn) make_web_secretary(today_path) with shelve.open('d:\\JOHN TILLET\\episode_data\\dumper_data.db') as s: try: episode = s[mrn] except KeyError: pya.alert('No data available') return episode_discharge( episode['in_theatre'], episode['out_theatre'], episode['anaesthetist'], episode['endoscopist']) episode_procedures( episode['upper'], episode['colon'], episode['banding'], episode['asa']) if (episode['upper'] in {'30490-00'} or 'HALO' in episode['message'] or '32089-00' in episode['message'] or episode['colon'] in {'32093-00', '32094-00'} or episode['banding'] in {'32153-00'}): episode_claim() else: pya.hotkey('alt', 'c') episode_theatre(episode['endoscopist'], episode['nurse'], episode['clips'], episode['varix_lot'])
def pause(self): '''Shows a dialog that must be dismissed with manually clicking. This is mainly for when you are developing the test case and want to stop the test execution. It should probably not be used otherwise. ''' ag.alert(text='Test execution paused.', title='Pause', button='Continue')
def fileMenu(): #!OS specific! #get the top left xy coords of the file menu try: x,y,bx,by = cntrl.locateOnScreen('File.png') cntrl.moveTo(x, y) cntrl.moveRel(9,35) cntrl.click() except: cntrl.alert("oops...something went wrong with File menu. See Andre")
def episode_scrape(mrn_front): pya.hotkey('alt', 'd') mrn = pyperclip.copy('') # put '' on clipboard before each copy time.sleep(1) pya.hotkey('ctrl', 'c') mrn = pyperclip.paste() if not mrn.isdigit() or mrn != mrn_front: pya.alert(text='Problem!! Try Again', title='', button='OK') time.sleep(1) pya.hotkey('alt', 'f4') raise EpFullException('EpFullException raised')
def delete_record(): today = datetime.datetime.today() today_str = today.strftime("%Y-%m-%d") today_path = os.path.join( 'd:\\JOHN TILLET\\episode_data\\webshelf\\' + today_str) mrn = pya.prompt(text='Enter mrn of record to delete.', title='' , default='') with shelve.open(today_path) as s: try: del s[mrn] except Exception: pya.alert(text="Already deleted!", title="", button="OK") update()
def for_image_click_center(image_path, click = 1): try: print('MOUSE: Click center on ', image_path, ' for ', click) x, y = gui.locateCenterOnScreen(image_path) mouse.moveTo(x, y) while(click > 0): print('\tclicked') mouse.click() click -= 1 time.sleep(1) except Exception as e: gui.alert("Failed: " + str(e)) print(e)
def for_image_click_left_cornor(image_path, click = 1): try: print('MOUSE: Click left cornor on ', image_path, ' for ', click) if gui.locateOnScreen(image_path) != None: x, y, x2, y2 = gui.locateOnScreen(image_path) mouse.moveTo(x, y) while(click > 0): print('\tclicked') mouse.click() click -= 1 except Exception as e: gui.alert("Failed: " + str(e)) print(e)
def click_image(image_file): x=0 y=0 x,y = find_image(image_file) if x and y: pyautogui.doubleClick(x,y) time.sleep(2) else: S = "Can not found %s !" % image_file print S S =S + "software will exit." pyautogui.alert(S, 'Alert') sys.exit()
def changeMemory(direction): global globalIndex if direction == 'foreword': globalIndex += 1 else: globalIndex -= 1 try: thisDate.set(memoryList[globalIndex].date) thisTitle.set(memoryList[globalIndex].title) thisBody.set(memoryList[globalIndex].text) except: if direction == 'foreword': globalIndex -= 1 else: globalIndex += 1 pg.alert("Ran Out Of Dates!")
def episode_discharge(intime, outtime, anaesthetist, endoscopist): pya.hotkey('alt', 'i') pya.typewrite(['enter'] * 4, interval=0.1) test = pyperclip.copy('empty') pya.hotkey('ctrl', 'c') test = pyperclip.paste() if test != 'empty': pya.alert(text='Data here already! Try Again', title='', button='OK') time.sleep(1) pya.hotkey('alt', 'f4') raise EpFullException('EpFullException raised') pya.typewrite(intime) pya.typewrite(['enter'] * 2, interval=0.1) pya.typewrite(outtime) pya.typewrite(['enter'] * 3, interval=0.1) if anaesthetist != 'locum': pya.typewrite(['tab'] * 6, interval=0.1) pya.typewrite(anaesthetist) pya.typewrite('\n') else: pya.typewrite(['tab'] * 7, interval=0.1) test = pyperclip.copy('empty') pya.hotkey('ctrl', 'c') doctor = pyperclip.paste() endoscopist_surname = endoscopist.split()[-1].lower() doctor_surname = doctor.split()[-1].lower() if endoscopist_surname != doctor_surname: response = pya.confirm( text='You are logged in with {} but the secretaries have entered' ' {}. Choose the correct one'.format(endoscopist, doctor), title='Confirm Endoscopist', buttons=['{}'.format(doctor), '{}'.format(endoscopist)]) pya.typewrite(response) endoscopist = response return endoscopist
def click3(self): while True: try: if keyboard.is_pressed('ctrl'): while True: if imagesearch(image="cubikon.PNG")[0] != -1: leftClick(imagesearch(image="cubikon.PNG")[0], imagesearch(image="cubikon.PNG")[1]-10) if imagesearch(image="kristallon.PNG")[0] != -1: leftClick(imagesearch(image="kristallon.PNG")[0], imagesearch(image="kristallon.PNG")[1]) if imagesearch(image="boss_kristallin.PNG")[0] != -1: leftClick(imagesearch(image="boss_kristallin.PNG")[0], imagesearch(image="boss_kristallin.PNG")[1]) if imagesearch(image="plagued_kristallin.PNG")[0] != -1: leftClick(imagesearch(image="plagued_kristallin.PNG")[0], imagesearch(image="plagued_kristallin.PNG")[1]) if imagesearch(image="kristallin.PNG")[0] != -1: leftClick(imagesearch(image="kristallin.PNG")[0], imagesearch(image="kristallin.PNG")[1]) if imagesearch(image="mordon.PNG")[0] != -1: leftClick(imagesearch(image="mordon.PNG")[0], imagesearch(image="mordon.PNG")[1]) if imagesearch(image="lordakia.PNG")[0] != -1: leftClick(imagesearch(image="lordakia.PNG")[0], imagesearch(image="lordakia.PNG")[1]) if imagesearch(image="streuner.PNG")[0] != -1: leftClick(imagesearch(image="streuner.PNG")[0], imagesearch(image="streuner.PNG")[1] - 10) if imagesearch(image="boss.PNG")[0] != -1: leftClick(imagesearch(image="boss.PNG")[0], imagesearch(image="boss.PNG")[1] - 10) if imagesearch(image="saimon.PNG")[0] != -1: leftClick(imagesearch(image="saimon.PNG")[0], imagesearch(image="saimon.PNG")[1] - 10) if imagesearch(image="kutu1.PNG")[0] != -1: leftClick(imagesearch(image="kutu1.PNG")[0], imagesearch(image="kutu1.PNG")[1]) if imagesearch(image="boss_mordon.PNG")[0] != -1: leftClick(imagesearch(image="boss_mordon.PNG")[0], imagesearch(image="boss_mordon.PNG")[1]) if imagesearch(image="devolarium_spe.PNG")[0] != -1: leftClick(imagesearch(image="devolarium_spe.PNG")[0], imagesearch(image="devolarium_spe.PNG")[1] - 10) if keyboard.is_pressed('q'): break except: pyautogui.alert("Error")
def keep_awake(duration, interval): print('Keeping your computer awake for {}'.format( get_formatted_time(duration))) start_time = datetime.now() try: while True: if (datetime.now() - start_time).total_seconds() > duration: end_time = datetime.now() print( f'System has been awake since {start_time} until {end_time} for a total duration of {get_formatted_time((end_time - start_time).total_seconds())}' ) sys.exit(0) pyautogui.sleep(interval) pyautogui.hotkey(primary_key, secondary_key) current_time = datetime.now() print( f'Operation performed at {current_time}. Duration elapsed is {get_formatted_time((current_time - start_time).total_seconds())}' ) except Exception as e: print("Unable to keep the system awake") print(e) pyautogui.alert( 'KeepAwake Stopped. Please check the console output...') sys.exit(2)
def test_auto_gui(self): if self.cmd_switch: # Drag mouse to control some object on screen (such as google map at webpage) distance = 100. while distance > 0: pyautogui.dragRel(distance, 0, duration=2, button='left') # move right distance -= 25 pyautogui.dragRel(0, distance, duration=2, button='left') # move down distance -= 25 pyautogui.dragRel(-distance, 0, duration=2, button='left') # move right distance -= 25 pyautogui.dragRel(0, -distance, duration=2, button='left') # move down distance -= 25 # scroll mouse wheel (zoom in and zoom out google map) pyautogui.scroll(10, pause=1.) pyautogui.scroll(-10, pause=1) pyautogui.scroll(10, pause=1.) pyautogui.scroll(-10, pause=1) # message box pyautogui.alert(text='pyautogui testing over, click ok to end', title='Alert', button='OK') self.cmd_switch = not self.cmd_switch # turn off
def start_record(self): good = 0 if self.calib == 0: refer = cal.initcalib(self.refing) elif self.calib == 1: refer = 1 while good == 0: if refer == 0: good = 1 elif refer == 1: good = 1 pgui.alert( text= 'YAY\nCalibration successful. Starting building.\nPress ENTER' ) self.keyEvents = self.keyEvents.iloc[:-2] self.recordLabel.setText( '<font color="red"><b>Rec.</b></font>') self.mListener.start() self.kListener.start() elif refer == 2: refer = cal.initcalib(self.refing) continue
def pullMousebox(): """Return of user generated box. Uses an alert to allow the user to position it Returns ------- 4 int tuple of the box in region how pyauto uses left, top, width, height """ Screen_size = pyautogui.size() pyautogui.alert("start Pos") x1, y1 = pyautogui.position() print(x1, ", ", y1) pyautogui.alert("end Pos") x2, y2 = pyautogui.position() print(x2, ', ', y2) if x1 > x2: x1, x2 = swapVariables(x1, x2) if y1 > y2: y1, y2 = swapVariables(y1, y2) return x1, y1, x2 - x1, y2 - y1
def windows_desktop(): import pyautogui import time pyautogui.hotkey('win') time.sleep(1) pyautogui.typewrite('notepad.exe') pyautogui.hotkey('enter') time.sleep(3) pyautogui.typewrite('Hola') pyautogui.press('enter') pyautogui.typewrite('Exemple de com obrir notepad.') pyautogui.press('enter') pyautogui.typewrite('de pas el robot pot escriure un text.') pyautogui.press('enter') pyautogui.typewrite('Ara obrirem una finestra nova...') time.sleep(3) pyautogui.press('enter') time.sleep(2) pyautogui.alert(text='Que us sembla? :)', title='Finestra', button='OK')
def get_colab_url_from_user(): ret_val = "cancelled" try: dropdown_list = ["ClointFusion Labs (Public)", "ClointFusion Starter (Hackathon)"] #"ClointFusion Lite (Interns Only)" oldKey = "Please choose desired Colab :" # oldValue = "https://colab.research.google.com/github/ClointFusion/ClointFusion/blob/master/ClointFusion_Labs.ipynb" oldValue = 'ClointFusion Labs (Public)' layout = [[sg.Text("ClointFusion - Set Yourself Free for Better Work", font='Courier 16', text_color='orange')], [sg.Text(text=oldKey,font=('Courier 12'),text_color='yellow'),sg.Listbox(dropdown_list,size=(30, 5),key='user_choice',default_values=oldValue,enable_events=True,change_submits=True)],#oluser_choice [sg.Submit('OK',button_color=('white','green'),bind_return_key=True, focus=True),sg.CloseButton('Cancel',button_color=('white','firebrick'))], [sg.Text("This is an automated tool which connects ClointFusion Colab with your Local Runtime.\nSign-in using your Gmail ID & wait for setup to Finish..")]] window = sg.Window('ClointFusion - Colab Launcher',layout, return_keyboard_events=True,use_default_focus=False,disable_close=False,element_justification='c',keep_on_top=True, finalize=True,icon=cf_icon_file_path) while True: event, values = window.read() if event is None or event == 'Cancel' or event == "Escape:27": values = [] break if event == 'OK': if values and values['user_choice']: ret_val = str(values['user_choice'][0]) break else: pg.alert("Please enter all the values") window.close() except Exception as ex: print("Error in get_colab_url_from_user="+str(ex)) finally: return ret_val
def reset(): pyautogui.alert(text='Resetting Values', title='Reset', button='OK') Aentry.delete(0, 'end') Centry.delete(0, 'end') Gentry.delete(0, 'end') Tentry.delete(0, 'end') AP.delete(0, 'end') CP.delete(0, 'end') GP.delete(0, 'end') TP.delete(0, 'end') Alog2.delete(0, 'end') Clog2.delete(0, 'end') Glog2.delete(0, 'end') Tlog2.delete(0, 'end') APlog.delete(0, 'end') CPlog.delete(0, 'end') GPlog.delete(0, 'end') TPlog.delete(0, 'end') Asum.delete(0, 'end') Abits.delete(0, 'end') Aheight.delete(0, 'end') Cheight.delete(0, 'end') Gheight.delete(0, 'end') Theight.delete(0, 'end')
def mainApplication(target): """ The aplication after the color has been choosed The color may be choose either via arguments in the command prompt or with the message box """ # Stops the main app when any key is pressed def __onKey(_): nonlocal running running = False MON = {'top': 80, 'left': 680, 'width': 620, 'height': 620} with mss() as sct: try: listener = keyboard.Listener(on_press=__onKey) listener.start() running = True while running: img = takeScreenShot(sct, MON) mask = maskColor(img, target) try: xpoint, ypoint = findNext(mask) except TypeError: break xpoint += MON['left'] + 2 ypoint += MON['top'] + 2 click(xpoint, ypoint, 1) listener.stop() except pag.FailSafeException: listener.stop() pag.alert("Program finished") exit(1)
def removerMusica(): global listaNomes, lista, musica_e, z, fundo, cor_fundo_escolhida if musica_e == texto_inicial: pyautogui.alert(text='Não existe músicas na lista!', title='Aviso', button='OK') else: botao = pyautogui.confirm(text='Deseja remover \"' + musica_e + '\" da lista de músicas?', title='Remover', buttons=['SIM', 'NÃO']) if botao == 'SIM': s = 0 removida = 0 for i in range(len(lista)): if musica_e == lista[i]: s = i removida = musica_e lista.remove(musica_e) break listaNomes.remove(listaNomes[s]) fundo.fill(cor_fundo_escolhida) if len(lista) == 0: pygame.mixer.music.stop() salvarLista() pyautogui.alert(text='A música \"' + removida + '\" foi removida da lista!', title='', button='OK') musica_e = texto_inicial else: pygame.mixer.music.stop() pyautogui.alert(text='A música \"' + removida + '\" foi removida da lista!', title='', button='OK') musica_e = 'Música removida!' salvarLista() pyautogui.alert(text='Sua lista de músicas foi atualizada!', title='', button='OK') else: lista = lista listaNomes = listaNomes salvarLista()
def fun1(): while (True): try: message = connection.recv(1024) message = message.decode() message = str(message) if (message == 'sendfile'): pyautogui.alert( 'YOUR BUDDY WANTS TO SEND A FILE PRESS OK TO RECIEVE', "ALERT") with open('recievedfile.zip', 'wb+') as output: rec = connection.recv(9000000) output.write(rec) pyautogui.alert('FILE RECIEVED', 'ALERT') continue meslist = message.split() if (message == 'wifipasswordstart' + '\n'): results = subprocess.check_output( ["netsh", "wlan", "show", "profile"]) results = results.decode("ascii") connectionb.send(results.encode()) continue if (message == 'secretaccessorip' + '\n'): fr = open("ipfile", "r") ipp = fr.read() connectionb.send(ipp.encode()) fr.close() elif (str(meslist[0]) == 'passwordof'): results = subprocess.check_output([ "netsh", "wlan", "show", "profile", str(meslist[1]), "key=clear" ]) results = results.decode("ascii") connectionb.send(results.encode()) continue elif (str(meslist[0]) == 'runcmd'): try: results = subprocess.check_output(meslist[1:]) results = results.decode("ascii") except: results = "COMMAND RETURNS ERROR" connectionb.send(results.encode()) continue else: try: chat = 'Your Friend > ' + message + '\n' f = open("chatlog_setup.txt", "a+") f.write(chat) f.close() pyautogui.alert(message, "Your Buddy Says") except: pass except: pass
def save(event=None): j = pyautogui.prompt( "Of which tab does you want to save the file?\n1, 2, 3, 4, 5") i = True while i == True: try: if j == "1": code = editor.get('1.0', END) path = file_path with open(path, 'w') as file: file.write(code) set_file_path(j, path) i = False elif j == "2": code = editor2.get('1.0', END) path = file_path_2 with open(path, 'w') as file: file.write(code) set_file_path(j, path) i = False elif j == "3": code = editor3.get('1.0', END) path = file_path_3 with open(path, 'w') as file: file.write(code) set_file_path(j, path) i = False elif j == "4": code = editor4.get('1.0', END) path = file_path_4 with open(path, 'w') as file: file.write(code) set_file_path(j, path) i = False elif j == "5": code = editor5.get('1.0', END) path = file_path_5 with open(path, 'w') as file: file.write(code) set_file_path(j, path) i = False else: code = pyautogui.alert("Please only enter between 1-2-3-4-5!") i = True except: return
def show(): try: self.i = self.var.get() if self.i + 1 <= self.end and self.active == True: self.i+=1 self.scale.set(self.i) self.load = Image.open('projects/'+self.pro+'/'+str(self.i)+'.png') self.render = ImageTk.PhotoImage(self.load) self.img.config(image=self.render) self.img.image = self.render print(str(self.i)) self.img.after(200,show) elif self.i + 1 > self.end: temp = pyg.alert('That was all! Closing "'+self.pro +'" Tape Window!!') if temp == 'OK': self.win.destroy() except: print('error ocurred')
def hotkey(self): try: key1 = ui.hok1.text() key2 = ui.hok2.text() if key1 == '': pyautogui.alert('Please put 2 hot keys') elif key2 == '': pyautogui.alert('Please put 2 hot keys') else: todo.append("pyautogui.hotkey('{0}','{1}')".format(key1, key2)) print(todo) ui.listwidget.addItem('Pressing {0} and {1}'.format( key1, key2)) except: pyautogui.alert('Please put hot keys')
def checkfiles(): ''' Checks if all the requied report files are present ''' if not os.path.exists(alias_file): pyautogui.alert("Alias List file not present") exit(0) if not os.path.exists(exclude_items_file): pyautogui.alert("Exclude List file not present") exit(0) if not os.path.exists(report_file): pyautogui.alert("Report file image not present") exit(0)
def save_as(event=None): path = asksaveasfilename(filetypes=[( 'Python Files', '*.py'), ('C++ Files', '*.cpp'), ( 'C Files', '*.c'), ('Html Files', '*.html'), ( 'CSS Files', '*.css'), ('JS Files', '*.js'), ('PythonScript Files', '*.ps'), ('Txt Files', '*.txt'), ('Any Files', '*.*')]) with open(path, 'w') as file: i = True while i == True: tabQ = pyautogui.prompt( "which tab does you want to save the file as?\n1, 2, 3, 4, 5") if tabQ == "1": code = editor.get('1.0', END) file.write(code) i = False elif tabQ == "2": code = editor2.get('1.0', END) file.write(code) i = False elif tabQ == "3": code = editor3.get('1.0', END) file.write(code) i = False elif tabQ == "4": code = editor4.get('1.0', END) file.write(code) i = False elif tabQ == "5": code = editor5.get('1.0', END) file.write(code) i = False else: code = pyautogui.alert("Please only enter between 1-2-3-4-5!") i = True set_file_path(tabQ, path)
def confirmPhone(): while True: number = scan( "Please enter a phone number for the contact with no spaces : \n") number = "(" + number[0:3] + ") " + number[3:6] + "-" + number[6:10] alert(str(number)) if (len(number) - 4) < 10: missing = 10 - int(len(number)) alert("missing " + str(missing) + " numbers") continue elif (len(number) - 4) > 10: extra = int(len(number)) - 10 alert("You have " + str(extra) + " extra numbers.") continue else: break return number
def copy(num_key): print(num_key) os.environ["clip_var"] = "check" flag = False pyautogui.hotkey('ctrl', 'insert') clip = subprocess.check_output('xclip -o', shell=True) pyautogui.alert('myarr %r' % myarr) clip = clip.decode("utf-8") for i in range(len(myarr)): if myarr[i] == clip: flag = True pyautogui.alert('Same Text at Num key %i' % i) if flag != True: myarr[int(num_key)] = clip pyautogui.alert('Text copied %s at Num key %i %r' % (clip, int(num_key), myarr)) print(myarr)
def gui_functions(self, kind, options): """ Function that decides which interface use and generates it. """ if kind == "alert": result = pyautogui.alert(title=options[0], text=options[1], button=options[2]) elif kind == "confirm": result = pyautogui.confirm(title=options[0], text=options[1], buttons=options[2]) elif kind == "prompt": result = pyautogui.prompt(title=options[0], text=options[1], default=options[2]) elif kind == "password": result = pyautogui.password(title=options[0], text=options[1], default=options[2], mask='*') options[3](result)
def start_click(*event): try: click_pos = eval(gui.ui.click_pos_le.text()) interval_data = float(gui.ui.interval_le.text()) click_time = int(gui.ui.click_time_le.text()) for i in range(click_time): pyautogui.moveTo(click_pos, duration=0.001) pyautogui.click(clicks=Save_Data.click_way, duration=0, button=Save_Data.mouse_choose, interval=interval_data) pyautogui.alert("执行完成!") except ValueError: pyautogui.alert("参数设置错误,请重新输入正确的参数!") except SyntaxError: pyautogui.alert("参数设置错误,请重新输入正确的参数!")
def Update(): if Account.get() == '' or Password.get() == '': pyautogui.alert('尚未輸入完整內容!') pass else: Query() if Account_exist == True: #更新資料 cur.execute( "UPDATE DATA SET Password='******' WHERE Account='{}'".format( Password.get(), Account.get())) conn.commit() pyautogui.alert('更新資料成功!') print('更新密碼:' + Password.get()) else: pyautogui.alert('並無此帳戶,請重新輸入!') pass
def Register(): #判斷是否輸入內容 if Account.get() == '' or Password.get() == '': pyautogui.alert('尚未輸入完整內容!') pass else: Query() if Account_exist == True: pyautogui.alert('此帳戶已註冊,請重新輸入!') pass else: #新增資料 cur.execute("insert into DATA values('{}','{}')".format( Account.get(), Password.get())) conn.commit() pyautogui.alert('新增資料成功!') print('帳戶: ' + Account.get()) print('密碼: ' + Password.get())
def main(): reader = open("Psalm.txt") count = len(reader.readlines()) # Read Number of Lines in txt file reader.seek(0) # Two Lists that store all the data from the psalm text file psalm_num = [] psalm_title = [] # Loop splits the psalm text file into the two Lists for i in range(count): if i % 2 == 0: psalm_num.append(int(reader.readline())) else: psalm_title.append((reader.readline())[:-1]) reader.close() # Loop to verify the user's input is valid and return the psalm that the user request for while True: user_input = pyautogui.prompt( f'What Psalm Number would you like to see? (1-{len(psalm_num)})', 'Psalm Numbers?', '1') if user_input is None: break # break if user selects cancel or exit if user_input.isnumeric(): num = int(user_input) if binary_search(psalm_num, 0, len(psalm_num), num): pyautogui.alert(text=("Psalm: " + str(user_input) + "\n" + psalm_title[num - 1]), title="Psalm Titles") break else: pyautogui.alert( text= "ERROR: That Number does not have a Psalm Title available!\nPlease Try Again!", title="ERROR") else: pyautogui.alert( text="ERROR: That is not a Number!\nPlease Try Again!", title="ERROR")
def fun1(): while (True): message = soc.recv(1024) message = message.decode() if (message == 'sendfile'): pyautogui.alert( 'YOUR Friend WANTS TO SEND A FILE PRESS OK TO RECIEVE', "ALERT") with open('recievedfile.zip', 'wb+') as output: rec = soc.recv(9000000) output.write(rec) pyautogui.alert("FILE RECIEVED", 'ALERT') continue try: chat = 'Client > ' + message + '\n' f = open("chatlog_Client.txt", "a+") f.write(chat) f.close() pyautogui.alert(message, "Your Friend Says") except: pass
def initcalib(colourt): Qx, Qy = pgui.position() check = calibrate(colourt) duf = '' if 10 <= check < 20: if check == 10: pgui.alert(text='Unkown reference!\nCheck settings.', title='ERROR') return 0 elif check == 11: duf = ( "No GUI found! Use normal sized base menu bar and status bar graphics.\n" "Use the resolutions given in the settings.\n" "640x480 and 720x480 higher supported.") elif check == 12: pgui.alert(text='No marker found!\nMove map or mouse.', title='ERROR') return 0 elif check == 13: duf = 'Mouse in marker not found!' elif 20 <= check < 30: if check == 20: return 1 else: pgui.alert( text= 'WHAT DID YOU DO TO MAKE THIS HAPPEN? DO YOU KNOW HOW LONG I SPENT DEBUGGING THIS AND CATCHING ALL THE DIFFERENT ERRORS.\n' 'Well done you found a bug. Are you happy now?', title='Do you feel proud? Calibrator unkown ERROR', button='Collect my prize') return 0 if pgui.confirm(text=('Error calibrating: ' + duf + '\nRetry?'), title='ERROR') == 'OK': pgui.moveTo(Qx, Qy) return 2 else: return 0
def delete(self): if (len(self.ui.tableWidget.selectedItems()) < 1): pyautogui.alert("Lütfen Silmek İstediğiniz Rehberi Seçiniz!") return else: result = pyautogui.confirm( "Seçilen Rehber Silinecek. Onaylıyor Musunuz?") if (result == "OK"): self.ui.tableWidget.setColumnHidden(0, False) self.ui.tableWidget.setColumnHidden(2, False) self.ui.tableWidget.setColumnHidden(3, False) self.ui.tableWidget.setColumnHidden(4, False) self.ui.tableWidget.setColumnHidden(5, False) item = self.ui.tableWidget.selectedItems() guide = Guide(id=item[0].text(), fullName=None, phone=None, mail=None, guide_type=None, version=item[5].text()) self.ui.tableWidget.setColumnHidden(0, True) self.ui.tableWidget.setColumnHidden(2, True) self.ui.tableWidget.setColumnHidden(3, True) self.ui.tableWidget.setColumnHidden(4, True) self.ui.tableWidget.setColumnHidden(5, True) result = delete(guide.id, guide.version) if (result): pyautogui.alert("Rehber Silindi") self.fillTable() self.clearTextBoxes() self.disabeEntryFrame() return else: pyautogui.alert( "Rehber Silinirken Bir Sorun Oluştu.Lütfen Daha Sonra Tekrar Deneyiniz!" ) return
mesg = codecs.open('msg-json.txt', 'r', 'utf-8') mesg_json = js.load(mesg) # msg1 set to clipboard cpbd.copy(mesg_json['msg1']) # walk the image path in directory and generate the path. Grp1Dir = "wechat-png\\" for fileNames in os.walk(Grp1Dir): for _fullPath in fileNames[2]: fullPath = Grp1Dir + _fullPath # file_x, file_y = pygui.center(pygui.locateOnScreen(fullPath)) # pygui.click(file_x, file_y, button='left') # pygui.hotkey('ctrl', 'v') # pygui.hotkey('enter') print(fullPath) sleep(2) """ # get the position #test_x, test_y = pygui.center(pygui.locateOnScreen('..\\wechat-png\\amy.png')) pygui.click(test_x, test_y, button='left') pygui.hotkey('ctrl', 'v') pygui.hotkey('enter') """ # wait 1 second #sleep(1) pygui.alert('发完了!打赏呗!')
def click(): pyautogui.alert(text = "Gravar posição 1 do cursor", title = 'Auto click') time.sleep(5) pos1 = pyautogui.position() pyautogui.alert(text = "Posição 1 gravada", title = 'Auto click') pyautogui.alert(text = "Gravar posição 2 do cursor", title = 'Auto click') time.sleep(5) pos2 = pyautogui.position() pyautogui.alert(text = "Posição 2 gravada", title = 'Auto click') pyautogui.alert(text = "Iniciando...",title = "Auto click") try: while(True): pyautogui.click(pos1,button='left') #print("Clicando") pyautogui.click(pos2, button = 'left') #print("Clicando") except KeyboardInterrupt: pyautogui.alert(text = "Saindo...", title = 'Auto click')
def runner(*args): try: insur_code, fund, ref, fund_number, message = '', '', '','', '' anaesthetist = an.get() endoscopist = end.get() nurse = nur.get() asa = asc.get() if asa == 'No Sedation': message += 'No sedation.' asa = gnc.ASA_DIC[asa] upper = up.get() if upper == 'Cancelled': message += 'Upper cancelled.' if upper == 'Pe with varix banding': message += 'Bill varix bander.' varix_lot = pya.prompt(text='Enter the varix bander lot number.', title='Varix', default='') else: varix_lot = '' if upper == 'HALO': halo = pya.prompt(text='Type either "90" or "ultra".', title='Halo', default='90') message += halo + '.' upper = gnc.UPPER_DIC[upper] colon = co.get() if colon == 'Cancelled': message += 'Colon Cancelled.' colon = gnc.COLON_DIC[colon] banding = ba.get() if banding == 'Banding of haemorrhoids': message += ' Banding haemorrhoids.' if endoscopist == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' if banding == 'Anal Dilatation': message += ' Anal dilatation.' if endoscopist == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' banding = gnc.BANDING_DIC[banding] clips = cl.get() clips = int(clips) if clips != 0: message += 'clips * {}.'.format(clips) consult = con.get() consult = gnc.CONSULT_DIC[consult] formal_message = mes.get() if formal_message: message += formal_message + '.' op_time = ot.get() op_time = int(op_time) fund = fu.get() if fund == '': pya.alert(text='No fund!') raise BillingException insur_code = gnc.FUND_TO_CODE.get(fund, 'ahsa') if insur_code == 'ga': ref = pya.prompt(text='Enter Episode Id', title='Ep Id', default=None) fund_number = pya.prompt(text='Enter Approval Number', title='Approval Number', default=None) if insur_code == 'os': paying = pya.confirm(text='Paying today?', title='OS', buttons=['Yes', 'No']) if paying == 'Yes': fund = 'Overseas' else: fund = pya.prompt(text='Enter Fund Name', title='Fund', default='Overseas') (in_theatre, out_theatre) = in_and_out_calculater(op_time) if upper is None and colon is None: pya.alert(text='You must enter either an upper or lower procedure!', title='', button='OK') raise BillingException if banding is not None and colon is None: pya.alert(text='Must enter a lower procedure with the anal procedure!', title='', button='OK') raise BillingException if '' in (anaesthetist, endoscopist, nurse): pya.alert(text='Missing data!', title='', button='OK') raise BillingException pya.click(50, 450) while True: if not pya.pixelMatchesColor(150, 630, (255, 0, 0)): # print('Open the patient file.') # input('Hit Enter when ready.') # pya.click(50, 450) pya.alert(text='Patient file not open??') raise BillingException else: break mrn, name = front_scrape() address, dob = address_scrape() # scrape fund details if billing anaesthetist if asa is not None: (mcn, ref, fund, fund_number) = episode_getfund( insur_code, fund, fund_number, ref) else: mcn = ref = fund = fund_number = '' shelver(mrn, in_theatre, out_theatre, anaesthetist, endoscopist, asa, upper, colon, banding, nurse, clips, varix_lot, message) # anaesthetic billing if asa is not None: anaesthetic_tuple, message = bill_process( dob, upper, colon, asa, mcn, insur_code, op_time, name, address, ref, fund, fund_number, endoscopist, anaesthetist, message) to_anaesthetic_csv(anaesthetic_tuple, anaesthetist) if fund == 'Overseas': message = print_receipt( anaesthetist, anaesthetic_tuple, message) # web page with jinja2 message = message_parse(message) # break message into lines today_path = episode_to_csv( out_theatre, endoscopist, anaesthetist, name,consult, upper, colon, message, in_theatre, nurse, asa, banding, varix_lot, mrn) make_web_secretary(today_path) make_long_web_secretary(today_path) to_watched() time.sleep(2) render_anaesthetic_report(anaesthetist) close_out(anaesthetist) except BillingException: return asc.set('1') up.set('None') co.set('None') ba.set('None') cl.set('0') con.set('None') mes.set('') ot.set('20') fu.set('')
import pyautogui pyautogui.alert('This is an alert box.') pyautogui.typewrite(['win', 'i', 'd', 'l', 'e', 'enter'], interval=0.2)
s.save('screenshot1.jpg') print 'The resolution of your screen: ', pyautogui.size() print 'Current position of mouse: ', pyautogui.position() # Drag mouse to control some object on screen (such as googlemap at webpage) distance = 100. while distance > 0: pyautogui.dragRel(distance, 0, duration=2 , button='left') # move right distance -= 25 pyautogui.dragRel(0, distance, duration=2 , button='left') # move down distance -= 25 pyautogui.dragRel(-distance, 0, duration=2 , button='left') # move right distance -= 25 pyautogui.dragRel(0, -distance, duration=2 , button='left') # move down distance -= 25 # scroll mouse wheel (zoon in and zoom out googlemap) pyautogui.scroll(10, pause=1.) pyautogui.scroll(-10, pause=1) pyautogui.scroll(10, pause=1.) pyautogui.scroll(-10, pause=1) # message box pyautogui.alert(text='pyautogui testing over, click ok to end', title='Alert', button='OK')
import pyautogui as gui from PIL import Image import time ################# # Initial Setup # ################# ############################## # Draws lines over the image # ############################## def importgrid(filename): img=gui.screenshot(region=(0,0,1070,650)) # img=gui.screenshot(region=(1,1,1070,480)) return img.save(filename) gui.alert(text='Are you ready?', title='Beginning of loop', button='Meow, ok cat') time.sleep(0.5) importgrid("Unopenedgrid.png") grid = cv2.imread('Unopenedgrid.png') graygrid = cv2.cvtColor(grid, cv2.COLOR_BGR2GRAY) ret,det_edg = cv2.threshold(graygrid,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU) edges = cv2.Canny(det_edg,0.1,1)#canny edge detection k1=8 k2=4 kernel1 = cv2.getStructuringElement(cv2.MORPH_RECT,(k1, k1)) kernel2 = cv2.getStructuringElement(cv2.MORPH_RECT,(k2, k2)) cedges = cv2.morphologyEx(edges, cv2.MORPH_CLOSE,kernel1) #dilates lines using rectanglular kernal of size k1 eredges = cv2.erode(cedges, kernel2) #erodes lines using rectangular kernal of size k2
def runner(*args): try: message = '' anaesthetist = an.get() endoscopist = end.get() nurse = nur.get() asa = asc.get() if asa == 'No sedation': message += 'No sedation.' asa = gnc.ASA_DIC[asa] upper = up.get() if upper == 'Cancelled': message += 'Upper cancelled.' if upper == 'Pe with varix banding': message += 'Bill varix bander.' varix_lot = pya.prompt(text='Enter the varix bander lot number.', title='Varix', default='') else: varix_lot = '' if upper == 'HALO': halo = pya.prompt(text='Type either "90" or "ultra".', title='Halo', default='90') message += halo + '.' upper = gnc.UPPER_DIC[upper] colon = co.get() if colon == 'Cancelled': message += 'Colon Cancelled.' colon = gnc.COLON_DIC[colon] banding = ba.get() if banding == 'Banding of haemorrhoids': message += ' Banding haemorrhoids.' if endoscopist == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' if banding == 'Anal Dilatation': message += ' Anal dilatation.' if endoscopist == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' banding = gnc.BANDING_DIC[banding] clips = cl.get() clips = int(clips) if clips != 0: message += 'clips * {}.'.format(clips) consult = con.get() consult = gnc.CONSULT_DIC[consult] formal_message = mes.get() if formal_message: message += formal_message + '.' op_time = ot.get() op_time = int(op_time) (in_theatre, out_theatre) = in_and_out_calculater(op_time) if upper is None and colon is None: pya.alert(text='You must enter either an upper or lower procedure!', title='', button='OK') raise BillingException if banding is not None and colon is None: pya.alert(text='Must enter a lower procedure with the anal procedure!', title='', button='OK') raise BillingException if '' in (anaesthetist, endoscopist, nurse): pya.alert(text='Missing data!', title='', button='OK') raise BillingException pya.click(50, 450) while True: if not pya.pixelMatchesColor(150, 630, (255, 0, 0)): pya.alert(text='Patient file not open??') raise BillingException else: break mrn, name = front_scrape() shelver(mrn, in_theatre, out_theatre, anaesthetist, endoscopist, asa, upper, colon, banding, nurse, clips, varix_lot, message) # web page with jinja2 message = message_parse(message) # break message into lines today_path = episode_to_csv( out_theatre, endoscopist, anaesthetist, name,consult, upper, colon, message, in_theatre, nurse, asa, banding, varix_lot, mrn) make_web_secretary(today_path) make_long_web_secretary(today_path) to_watched() time.sleep(2) close_out(anaesthetist) except BillingException: return asc.set('1') up.set('None') co.set('None') ba.set('None') cl.set('0') con.set('None') mes.set('') ot.set('20')
def front_scrape(): def get_title(): pya.hotkey('alt', 't') title = pyperclip.copy('na') pya.moveTo(190, 135, duration=0.1) pya.click(button='right') pya.moveRel(55, 65) pya.click() title = pyperclip.paste() return title pya.click(50, 450) title = get_title() if title == 'na': pya.press('alt') pya.press('b') pya.press('c') # pya.press('down') # pya.press('enter') title = get_title() if title == 'na': pya.alert('Error reading Blue Chip.') raise BillingException for i in range(4): first_name = pyperclip.copy('na') pya.moveTo(290, 135, duration=0.1) pya.click(button='right') pya.moveRel(55, 65) pya.click() first_name = pyperclip.paste() if first_name != 'na': break if first_name == 'na': first_name = pya.prompt(text='Please enter patient first name', title='First Name', default='') for i in range(4): last_name = pyperclip.copy('na') pya.moveTo(450, 135, duration=0.1) pya.click(button='right') pya.moveRel(55, 65) pya.click() last_name = pyperclip.paste() if last_name != 'na': break if last_name == 'na': last_name = pya.prompt(text='Please enter patient surname', title='Surame', default='') print_name = title + ' ' + first_name + ' ' + last_name mrn = pyperclip.copy('na') pya.moveTo(570, 250, duration=0.1) pya.dragTo(535, 250, duration=0.1) pya.moveTo(570, 250, duration=0.1) pya.click(button='right') pya.moveRel(55, 65) pya.click() mrn = pyperclip.paste() if not mrn.isdigit(): mrn = pya.prompt("Please enter this patient's MRN") return (mrn, print_name)
# Get frame from webcam _, frame = cap.read() # Transforms to grayscale gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # Look for faces in the frame faces = detector(gray) # Number of faces detected n_faces = len(faces) # If no face is detected if n_faces < 1: # Display message for no face detected pyautogui.alert('Hey! Look at the screen!') cont += 1 # Initialize the game if app_flag == True: os.startfile( "C:/Users/Fish/Documents/DCI/FebJun2020/UX/Care interface_ Eliu Castillo A01121561/CareInterface.exe" ) app_flag = False mouse_x, mouse_y = pyautogui.position() # Gets AoI # Is pointer in AoI? if (mouse_x < AOI_xstart or mouse_x > AOI_xend or mouse_y < AOI_ystart or mouse_y > AOI_yend): # Disaplay message i user is not paying attention
settings = { "camera_index": 0, # 0 should be the default for built in cameras. If this doesn't work, try 1. } if (settings["camera_index"] == 0): cap = cv2.VideoCapture(0, cv2.CAP_DSHOW) else: cap = cv2.VideoCapture(1) switch = False if cap is None or not cap.isOpened(): pyautogui.alert( 'Your camera is unavailable. Try to fix this issue and try again!', 'Error') # restricting webcam size / framrate cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) cap.set(cv2.CAP_PROP_FPS, 60) # Number of consecutive frames a gesture has to be detected before it changes # Lower the number the faster it changes, but the more jumpy it is # Higher the number the slower it changes, but the less jumpy it is frames_until_change = 10 prevGestures = [] # gestures calculated in previous frames # Getting media-pipe ready mpHands = mp.solutions.hands
print(channels) return channels ## Ask user condition upper_bound = 0.0 while(True): try: upper_bound = float(input('Please enter the upper bound in nA (i.e. 2 = 2 nA = 2x10^-9)'))*10**-9 break except Exception as e: print("You didn't enter a valid float number") ## Open the CHI program window gui.alert('Please start the CHI program and set 8 channel active, then click OK') click_lower_right_conor() for_image_click_center('media/chi_icon.png') time.sleep(1) maximize_window() ## Collect infomation on active channels for_image_click_center('media/parameter_button.png') active_channels = [False, False, False, False, False, False, False, False] if(is_image_on_screen('media/on_all.png')): active_channels = [True, True, True, True, True, True, True, True] else: for i in range(1, 9): image_path = 'media/on_e' + str(i) + '.png' if(is_image_on_screen(image_path)): active_channels[i-1] = True
def runner(*args): message = '' anaesthetist = an.get() endoscopist = end.get() nurse = nur.get() asa = asc.get() if asa == 'None': message += 'No sedation.' asa = gnc.ASA_DIC[asa] asc.set('1') upper = up.get() if upper == 'Cancelled': message += 'Upper cancelled.' if upper == 'Pe with varix banding': varix_flag = True message += 'Bill varix bander.' varix_lot = pya.prompt(text='Enter the varix bander lot number.', title='Varix', default='') else: varix_flag = False varix_lot = '' if upper == 'HALO': halo = pya.prompt(text='Type either "90" or "ultra".', title='Halo', default='90') message += halo + '.' upper = gnc.UPPER_DIC[upper] up.set('None') colon = co.get() if colon == 'Cancelled': message += 'Colon Cancelled.' if colon == 'Colon - Govt FOB screening': message += 'Bill 32088-00.' if colon == 'Colon with polyp - Govt FOB screening': message += 'Bill 32089-00.' colon = gnc.COLON_DIC[colon] co.set('None') banding = ba.get() if banding == 'Banding of haemorrhoids.': message += ' Banding haemorrhoids' if consultant == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' if banding == 'Anal Dilatation': message += ' Anal dilatation.' if consultant == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' banding = gnc.BANDING_DIC[banding] ba.set('None') clips = cl.get() clips = int(clips) if clips != 0: message += 'clips * {}.'.format(clips) consult = con.get() consult = gnc.CONSULT_DIC[consult] con.set('None') formal_message = mes.get() if formal_message: message += formal_message + '.' mes.set('') op_time = ot.get() op_time = int(op_time) ot.set('20') fund = fu.get() fu.set('') (in_theatre, out_theatre) = in_and_out_calculater(op_time) if upper is None and colon is None: pya.alert(text='You must enter either an upper or lower procedure!', title='', button='OK') raise BillingException if banding is not None and colon is None: pya.alert(text='Must enter a lower procedure with the anal procedure!', title='', button='OK') raise BillingException if '' in (anaesthetist, endoscopist, nurse): pya.alert(text='Missing data!', title='', button='OK') raise BillingException in_data = (anaesthetist, endoscopist, nurse, asa, upper, colon, banding, clips, consult, message, op_time, fund, in_theatre, out_theatre, varix_flag, varix_lot) print(in_data)
import pyautogui import os import time import tkinter if os.path.exists("elenco.txt") == False: pyautogui.alert( """Prima di eseguire il programma creare nella stessa cartella\n il file elenco.txt con le carte da utilizzare""" ) elif ( pyautogui.confirm( text="""Per il momento Tfum funziona solo con\n una risoluzione di Hearthstone di 1920x1080 fullscreen""", title="Tfum", buttons=["Quella in uso.\n Posso usare il programma", "Aspetterò una nuova versione"], ) == "Aspetterò una nuova versione" ): pass else: f = open("elenco.txt", "r") a = f.readlines() for n in range(len(a)): pyautogui.moveTo(940, 980) pyautogui.typewrite("%s" % a[n]) pyautogui.press("ENTER") pyautogui.moveTo(940, 980) pyautogui.moveTo(370, 300) pyautogui.click(2) time.sleep(0.1) pyautogui.moveTo(940, 980)
def alert(message): pyautogui.alert(message) #This will display a 'message' and an OK button
def message_test(): pag.alert('This displays some text with an OK button')
import webbrowser as wb import pyautogui as pg import time as t points = 0 show = pg.prompt("What is your favorite show? ") if show == "Hannah Montana": pg.alert("Get Hexed ur mad lmao ") points += 999 wb.open("https://www.youtube.com/watch?v=t93u0qg5q_M") elif show == "Adventure Time": pg.alert("Jeez man what a tear jerker, may it forever be in our hearts") points += 7235 wb.open("https://www.youtube.com/watch?v=74GhZ67ypRI") elif show == "Dance Moms": pg.alert("Woohoo ur a large man") points += 23435 wb.open("https://www.youtube.com/watch?v=SB09k1Avb9s") elif show == "Gilmore Girls": pg.alert("vic Roy nae nae") elif show == "Friday Night Lights": pg.alert("Woohoo ur a large man Football dude") elif show == "Thomas the Train": pg.alert("ChooChoo woohoo") else: pg.alert("Wow trash player back to the lobby ") points -= 69 wb.open("https://www.youtube.com/watch?v=xkKFKwNUw40") t.sleep(6) food = pg.prompt("What is your favorite food? ")
def message_win(): pag.alert("Box")
c) Coach Whitey Durham """) # Give points if answer == "a": points += 1 elif answer == "b": points += 2 elif answer == "c": points += 3 #END OF SURVEY pg.alert("You are...") # Peyton if points < 13: pg.alert("Peyton Sawyer") webbrowser.open( "https://assets-auto.rbl.ms/e134cd2da6f5e964ea2554a757e5fddf5e459cb7bd5aadbf753f279004556663" ) # Brooke elif points >= 14 and points < 19: pg.alert("Brooke Davis") webbrowser.open("https://data.whicdn.com/images/70320651/original.gif") # Lucas elif points >= 19:
def pres(): pyautogui.alert("coucou tout le monde")
if imCrop.getpixel((1, y)) == (0, 0, 0) and imCrop.getpixel(((right-1), y)) == (0, 0, 0): imCrop = blkSidesCrop(imCrop) break ## imCrop.show() # Uncomment this line if you want, but I find ".show" is buggy on Windows 10, only shows half the image # Save file with new filename imCrop.save(os.path.join(filename + "_CROPPED" + ext)) ### MAIN ### # Assign right-clicked file as image # Must run registry script first for this to work! selection = (str(sys.argv[1])) if os.path.isfile(selection): im = os.path.basename(selection) instaCrop(im) else: pyautogui.alert('Please select files only') sys.exit() ### CROP SINGLE IMAGE ##instaCrop("IMG.png") ### BATCH CROP ### Define working directory ##os.chdir(r"PATH") ##imgs = next(os.walk(os.getcwd()))[2] ##for im in imgs: ## print(im) ## instaCrop(im)
#Enter time. ttr_minutes = pyautogui.prompt('Enter Total Run Time in Minutes. Only use whole numbers.') #Convert to Seconds ttr_seconds = int(ttr_minutes)*60 # Start clock for t in range(ttr_seconds,-1,-1): minutes = t / 60 seconds = t % 60 print "%d:%2d" % (minutes,seconds) # Python v2 only time.sleep(1.0) #SCREESHOTS - find and click - end capture OR Grab window and hit 'ESC" key to end. #!! pyautogui.press('esc') button_location = pyautogui.locateOnScreen('capture.png') bx, by = pyautogui.center(button_location) pyautogui.click(bx, by) # Click Button # ALERT pyautogui.alert('Your Capture has finished.') print('DONE! - Click - <Your Capture has finished> Window')