# from datetime import datetime as dtime # from time import sleep # from win32api import GetKeyState # from win32con import VK_CAPITAL # import keyb13 as keys_ from time import sleep import pyautogui as gui '''bilant quick hotkey''' pause_ = 0.05 interval_ = 0.05 #------------------------------------------------------------------------------- # win_ = gui.getWindow('Situatii financiare', exact=True) # win_.set_foreground() # gui.hotkey('altright', 'm', pause=pause_) # gui.press('tab', 39, interval=interval_, pause=pause_) # gui.typewrite('ELKAN', pause=pause_) # gui.press('tab', presses=1, pause=pause_) # gui.typewrite('CLAUDIA', pause=pause_) # gui.press('tab', presses=1, pause=pause_) # gui.hotkey('altright', 'down', pause=pause_) # gui.press('down', presses=4, interval=interval_, pause=pause_) # gui.press('enter', pause=pause_) # gui.press('tab', presses=1, pause=pause_) # gui.typewrite('18010', pause=pause_) #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- '''capslock state display with keyboard and pywin32''' # print(GetKeyState(VK_CAPITAL)) # print(keys_.key_to_scan_codes('capslock')) #=============================================================================== # while True: # if keys_.is_pressed(58): # if GetKeyState(VK_CAPITAL) == 1: gui.alert('{0}'.format('capslock off'), 'capslock_state', button='ok', timeout=550) # else: gui.alert('{0}'.format('capslock on').upper(), 'capslock_state', button='ok', timeout=550) # keys_.wait(58) #=============================================================================== '''send notif if nothing hapends in 5 seconds''' #=============================================================================== # t = 1 # while True: # if t == 1: # print('mailing') # ts = dtime.now() # sleep(1) # t += 1 # if t == 10: # break # # tn = dtime.now() # print(tn - ts) # sleep_time = (tn - ts).total_seconds() > 5 # if sleep_time: # print('...zzz...') # else: # print('mailing') #=============================================================================== # p = True # print(p==1) # def downTime(): # t = 0 # while True: # if kb.is_pressed('shift'): # t+=1 # time.sleep(1) # if t>2: # t=1 # print(t) # # # while True: # downTime() '''timer decorator try''' #=============================================================================== # def my_decor(func): # def wrapper(*args, **kwargs): # start = time.time() # print(start) # func(*args, **kwargs) # end = time.time() # print(end) # return wrapper # # @my_decor # def file_filter(_ext): # print('searching files') # for i in recipisa.setpath(_ext): # print(i) # print('nothing found') # # file_filter('.py') #=============================================================================== '''contdown sample h, mins, secs''' #=============================================================================== # t = 0 # hors, rem = divmod(t, 60) # mins, secs = divmod(rem, 60) # timeformat = '{:02d} : {:02d} : {:02d}'.format(hors, mins, secs) # print(timeformat) #=============================================================================== '''contdown sample mins, secs''' # =============================================================================== # t = 60 # while True: # rem, hors = divmod(t, 60) # mins, secs = divmod(rem, 60) # timeformat = '{:02d} : {:02d} : {:02d}'.format(mins, secs, hors) # print(timeformat, end='\r') # t -= 1 # sleep(1) # =============================================================================== def count_down(t): while t >= 0: mins, secs = divmod(t, 60) tf = '{:02d}:{:02d}'.format(mins, secs) print(tf, end='\r') t -= 1 sleep(1) else: print('contdown finished') count_down(10)