def getPositionBotaoComprar(): print('\tClick com botão direito no botão comprar.') x, y = getPosicaoDoClick() print('\n\tPosição do botão comprar: ({}, {})'.format(x, y)) win32api.Beep(800, 150) win32api.MessageBeep() return x, y
def OnFindNext(self, id, code): if not self.editFindText.GetWindowText(): win32api.MessageBeep() return if self.DoFindNext() != FOUND_NOTHING: if not self.butKeepDialogOpen.GetCheck(): self.DestroyWindow()
def DeleteSelected(self): try: num = self.GetNextItem(-1, commctrl.LVNI_SELECTED) if num < self.GetItemCount()-1: # We cant delete the last self.DeleteItem(num) except win32ui.error: win32api.MessageBeep()
def OnOK(self): self.UpdateData(1) for id, name in [(101,'greppattern'), (102,'dirpattern'), (103,'filpattern')]: if not self[name]: self.GetDlgItem(id).SetFocus() win32api.MessageBeep() win32ui.SetStatusText("Please enter a value") return self._obj_.OnOK()
def show_toast(title, message, timeout=2000, beep=True, threaded=False): if beep: win32api.MessageBeep() if threaded: t = threading.Thread(target=_show_toast, args=(title, message, timeout)) t.start() return t else: return _show_toast(title, message, timeout)
def calibrar(self): ''' Vai receber os valores dos campos de calibração e calibrar as traves ''' # Apresentar Tutorial global tutorial_verificacao if tutorial_verificacao: tutorial_verificacao = not tutorial_verificacao win32.MessageBeep(1) win32.MessageBox(0, tutorial, 'Tutorial Calibragem') try: self.xTotalGol = abs(int(self.xCalibrarTraveEsquerda.get())) + abs(int(self.xCalibrarTraveDireita.get())) self.yTotalGol = 450 - abs(int(self.yCalibrarTraveAltura.get())) except: win32.MessageBeep(1) win32.MessageBox(0, 'Error: Argumentos em falta...', 'Error') else: try: self.xTotalGol = abs(int(self.xCalibrarTraveEsquerda.get())) + abs(int(self.xCalibrarTraveDireita.get())) self.yTotalGol = 450 - abs(int(self.yCalibrarTraveAltura.get())) except: win32.MessageBeep(1) win32.MessageBox(0, 'Error: Argumentos em falta...', 'Error')
def DeleteSelected(self): try: num = self.GetNextItem(-1, commctrl.LVNI_SELECTED) item_id = self.GetItem(num)[6] from bdb import Breakpoint for bplist in Breakpoint.bplist.values(): for bp in bplist: if id(bp) == item_id: self.debugger.clear_break(bp.file, bp.line) break except win32ui.error: win32api.MessageBeep() self.RespondDebuggerData()
def aemReplicate(): print("Replicating") import win32api,win32con PkgName=existingRelease()[0] PkgVersion=float(existingRelease()[1]) pkgDownloadName=existingRelease()[2] win32api.MessageBeep(win32con.MB_ICONERROR) isReplicate=win32api.MessageBox(0, "Replcating to "+env[0]+" pub", "Replication",win32con.MB_ICONQUESTION | win32con.MB_YESNO |win32con.MB_DEFAULT_DESKTOP_ONLY| win32con.MB_TOPMOST) if(isReplicate==6): print("replicating....") replicateStatus=os.system("curl -u admin:admin -X POST http://"+env[1]+":4502/crx/packmgr/service/.json/eProjectName/packages/groupName/"+pkgDownloadName+"?cmd=replicate") #checking error in replication if(replicateStatus != 0): in32api.MessageBeep(win32con.MB_ICONERROR) win32api.MessageBox(0, "Replcation Failed on "+env[0]+"", "Replication Failed on "+env[0]+"!!!",win32con.MB_ICONERROR |win32con.MB_DEFAULT_DESKTOP_ONLY| win32con.MB_TOPMOST) else: win32api.MessageBeep(win32con.MB_ICONINFORMATION) win32api.MessageBox(0, "Done on "+env[0]+" ALL", "Replication done on "+env[0]+" ALL",win32con.MB_ICONASTERISK | win32con.MB_DEFAULT_DESKTOP_ONLY|win32con.MB_TOPMOST) else: print("don't replicate") win32api.MessageBeep(win32con.MB_ICONINFORMATION) win32api.MessageBox(0, "Done on "+env[0]+" Author", "didn't Replicate on "+env[0]+" pub",win32con.MB_DEFAULT_DESKTOP_ONLY|win32con.MB_ICONEXCLAMATION)
def GotoNextBookmarkEvent(self, event, fromPos=-1): """ Move to the next bookmark """ if fromPos==-1: fromPos, end = self.GetSel() startLine = self.LineFromChar(fromPos)+1 # Zero based line to start nextLine = self.GetDocument().MarkerGetNext(startLine+1, MARKER_BOOKMARK)-1 if nextLine<0: nextLine = self.GetDocument().MarkerGetNext(0, MARKER_BOOKMARK)-1 if nextLine <0 or nextLine == startLine-1: win32api.MessageBeep() else: self.SCIEnsureVisible(nextLine) self.SCIGotoLine(nextLine) return 0
def desenhar(self): """ Função que redesenha os itens com novas posições e novos dados, Aqui tmb será tirado o printscreen caso ativado """ self.canvas.itemconfig('goleiro', start=-(170 + (self.angulo + 1)), extent=-20) self.canvas.itemconfig('textoangulo', text='Goleiro: {}º'.format(self.angulo)) self.canvas.itemconfig('xreal', text='xReal: {}'.format(self.xReal)) self.canvas.itemconfig('yreal', text='yReal: {}'.format(self.yReal)) self.canvas.itemconfig('x', text='x: {}'.format(self.x)) self.canvas.itemconfig('y', text='y: {}'.format(self.y)) self.canvas.itemconfig('raio', text='Raio: {}'.format(self.raio)) #self.canvas.move('bola', self.xbola, self.ybola) if self.bolaLigada: global contPrints self.canvas.delete(self.bolaSimulacao) try: if self.raio > 0 and self.raio < self.raioDefesa and int(self.x) > 0 and int(self.y) > 0: """Caso o raio seja menor do que o indicado, a bola ficara verde e será habilitada a defesa""" self.bolaSimulacao = self.canvas.create_oval(self.xbola - self.tamanhoBola, self.ybola - self.tamanhoBola, self.xbola + self.tamanhoBola, self.ybola + self.tamanhoBola, fill='green', tag='bola') print('Defender: {}'.format(self.angulo)) if self.pausarNoGolLigado and self.yReal > -10: win32.MessageBeep(1) img = ImageGrab.grab() #img.show() try: #Getting path of the program img.save("{}\\goalPhoto{}.jpg".format(self.pathScreenshot, contPrints)) contPrints += 1 except: win32.MessageBox(0, 'Caminho inválido', 'Erro Print') self.comecar() time.sleep(0.3) else: self.bolaSimulacao = self.canvas.create_oval(self.xbola - self.tamanhoBola, self.ybola - self.tamanhoBola, self.xbola + self.tamanhoBola, self.ybola + self.tamanhoBola, fill=self.corBola, tag='bola') except: pass
def MakeDocumentWritable(self): pretend_ss = 0 # Set to 1 to test this without source safe :-) if not self.scModuleName and not pretend_ss: # No Source Control support. win32ui.SetStatusText( "Document is read-only, and no source-control system is configured" ) win32api.MessageBeep() return 0 # We have source control support - check if the user wants to use it. msg = "Would you like to check this file out?" defButton = win32con.MB_YESNO if self.IsModified(): msg = msg + "\r\n\r\nALL CHANGES IN THE EDITOR WILL BE LOST" defButton = win32con.MB_YESNO if win32ui.MessageBox(msg, None, defButton) != win32con.IDYES: return 0 if pretend_ss: print("We are only pretending to check it out!") win32api.SetFileAttributes( self.GetPathName(), win32con.FILE_ATTRIBUTE_NORMAL ) self.ReloadDocument() return 1 # Now call on the module to do it. if self.scModule is None: try: self.scModule = __import__(self.scModuleName) for part in self.scModuleName.split(".")[1:]: self.scModule = getattr(self.scModule, part) except: traceback.print_exc() print("Error loading source control module.") return 0 if self.scModule.CheckoutFile(self.GetPathName()): self.ReloadDocument() return 1 return 0
print(api.GetFullPathName('.')) print(api.GetLocalTime()) print(api.GetLogicalDriveStrings().replace('\x00', ' ')) print(api.GetLogicalDrives()) print(api.GetLongPathName('C:')) print(api.GetModuleFileName(0)) print(api.GetNativeSystemInfo()) print(hex(api.GetSysColor(con.COLOR_WINDOW))) print(api.GetSystemDirectory()) print(api.GetSystemInfo()) print(api.GetSystemMetrics(con.SM_CXSCREEN)) print(api.GetSystemTime()) print(api.GetTickCount()) # print(api.GetTimeZoneInformation()) print(api.GetUserDefaultLangID()) print(api.GetUserName()) print(api.GetVersion()) print(api.GetVolumeInformation('C:')) print(api.GetWindowsDirectory()) print(api.GlobalMemoryStatus()) print(api.MessageBeep()) print(api.MessageBox(0, 'hello', 'world', con.MB_OK)) size = api.RegQueryInfoKey(con.HKEY_LOCAL_MACHINE) print(size) for i in range(size[0]): print(api.RegEnumKey(con.HKEY_LOCAL_MACHINE, i)) try: print(api.SearchPath('.', 'win32con.txt')) except: print('error') print(api.WinExec('Notepad'))
def EditSelected(self): win32api.MessageBeep()
def DeleteSelected(self): win32api.MessageBeep()
def manual(self): if self.since_last_manual > 30: self.go_top() win32api.MessageBeep() self.last_manual = time.time()
def message_beep(seconds=5): for i in range(seconds): win32api.MessageBeep() time.sleep(1)
def bell(self): win32api.MessageBeep()
achou_o_final = False #data = serial.Serial('com6', 5000, timeout=1) #TODO saved = 0 contador = 0 try: db = shelve.open('dados.db') tuplaMax = (int(db.get('h_max')), int(db.get('s_max')), int(db.get('v_max'))) tuplaMin = (int(db.get('h_min')), int(db.get('s_min')), int(db.get('v_min'))) db.close() print(tuplaMin, tuplaMax) except: text = 'É necessaria calibrar as cores antes, inicie o simulador e faça a configuração (Cor Bola).' win32.MessageBeep(1) win32.MessageBox(0, text, 'Erro') tuplaMin = ( 0, 142, 79 ) #TODO COMENTAR ESSAS LINHAS PARA COR <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< tuplaMax = (42, 255, 255) def sendArduino(raio, angulo): global data global saved global contador #print("Raio: {:.0f}".format(raio)) #contador +=1 #if contador % 10 == 0:
def show_msg(title="test msg", msg="msg from admin"): win32api.MessageBox(0, msg, title) win32api.MessageBeep(0)
def sendMessage(title="Ejemplo Windows API", message="Listo", type_message=win32con.MB_OK): #win32api.Beep(200, 200) win32api.MessageBeep(win32con.MB_ICONASTERISK) win32api.MessageBox(0, message, title, type_message)
def beep(): win32api.MessageBeep()
def desenhar(self): """ Função que redesenha os itens com novas posições e novos dados, Aqui tmb será tirado o printscreen caso ativado e enviado informações via serial para o programa do ARDUINO! """ self.canvas.itemconfig('goleiro', start=-(170 + (self.angulo + 1)), extent=-20) self.canvas.itemconfig('textoangulo', text='Goleiro: {}º'.format(self.angulo)) self.canvas.itemconfig('xreal', text='xReal: {}'.format(self.xReal)) self.canvas.itemconfig('yreal', text='yReal: {}'.format(self.yReal)) self.canvas.itemconfig('x', text='x: {}'.format(self.x)) self.canvas.itemconfig('y', text='y: {}'.format(self.y)) self.canvas.itemconfig('raio', text='Raio: {}'.format(self.raio)) #self.canvas.move('bola', self.xbola, self.ybola) if self.bolaLigada: global contPrints self.canvas.delete(self.bolaSimulacao) try: if self.raio > 0 and self.raio < self.raioDefesa and int( self.x) > 0 and int(self.y) > 0: """Caso o raio seja menor do que o indicado, a bola ficara verde e será habilitada a defesa""" self.bolaSimulacao = self.canvas.create_oval( self.xbola - self.tamanhoBola, self.ybola - self.tamanhoBola, self.xbola + self.tamanhoBola, self.ybola + self.tamanhoBola, fill='green', tag='bola') print('Defender: {}'.format(self.angulo)) try: """Caso a opção dos prints estiver ligada, salvar o print no pathScreenshot""" if self.pausarNoGolLigado and self.yReal > -10: win32.MessageBeep(1) img = ImageGrab.grab() #img.show() try: #Getting path of the program img.save("{}\\goalPhoto{}.jpg".format( self.pathScreenshot, contPrints)) contPrints += 1 except: win32.MessageBox(0, 'Caminho inválido', 'Erro Print') self.comecar() time.sleep(0.3) """Caso a opção sendSerial estiver habilitada, Fazer o envio por porta serial COM3, COM4...""" if self.serialLigada and self.yReal > -10: #Tratar o angulo pois o goleiro no arduino está preset 90º pos = self.angulo if pos > 90: add_value = pos - 90 pos = 90 + add_value pos = 180 - pos #TODO PARA INVERTER, BASTA DESCOMENTAR ESSE CÓDIGO elif pos < 90: subt_value = 90 - pos pos = 90 - subt_value pos = 180 - pos #TODO PARA INVERTER, BASTA DESCOMENTAR ESSE CÓDIGO self.data.write(struct.pack('>B', pos)) #time.sleep(0.2) except () as excecao: print(excecao) else: """Caso não entre no padrão correto para defesa, ele retorna para as configurações iniciais (Cor da bola) (set 90º motor)""" self.bolaSimulacao = self.canvas.create_oval( self.xbola - self.tamanhoBola, self.ybola - self.tamanhoBola, self.xbola + self.tamanhoBola, self.ybola + self.tamanhoBola, fill=self.corBola, tag='bola') if self.serialLigada: self.data.write(struct.pack('>B', 90)) except: pass
def playsound(data): win32api.MessageBeep(data)