def __init__(self): self.mouse = mouse.Mouse() self.exit = False self.current_stage = None self.stage_time = time.time() self.stage_limit = 300 self.set_stage(cut.Cut(self))
def __init__(self, display): self.mouse = mouse.Mouse(self) self.display = display self.running = True self.clock = pygame.time.Clock() self.frame_rate = 30 self.mask = None
def __init__(self): self.k_events = [] self.m_events = [] self.q_events = [] self.mouse = mouse.Mouse() self.keyboard = keys.Keyboard() self.old_mouse_pos = (pygame.mouse.get_pos()) self.counter = 0
def save_file(): #this routine saves the data file once the scan is complete mouse1 = mouse.Mouse() #defines the mouseclicker routine mouse1.invisible_click((15,31)) #clicks the file menu time.sleep(0.5) #wait for menu to open mouse1.invisible_click((24,79)) #clicks save as time.sleep(1.0) #waits for the dialog box to open mouse1.invisible_click((928,461)) #sets save to channel B time.sleep(0.5) #waits for channel to update mouse1.invisible_click((1034,763)) #clicks the save button time.sleep(3.0) #waits for file to save mouse1.invisible_click((1103,571)) #clicks the ok button
def __init__(self, parent, reverse=False): self.parent = parent self.current_stage_index = 0 self.stages = [] if config.MAGIC_LOGS else [ move_randomly.MoveRandomly(self), orient.Orient(self), locate.Locate(self, reverse=reverse) ] self.exit = False self.mouse = mouse.Mouse() self.settled = True
def test(cont): '''This is used to test the camera class from Camera.blend. It checks to see if the game object exists, and if it does not, runs the camera''' # If the camera object does not exist, create it if 'MOUSE' not in cont.owner: cont.owner['MOUSE'] = mouse.Mouse() bge.render.showMouse(True) cont.owner['MOUSE'].scenes = [cont.owner.scene] else: # Otherwise run it with the status of the mouse click as a test # input cont.owner['MOUSE'].update() print(cont.owner['MOUSE'].get_over(cont.owner.scene))
def __init__(self): args = self.parse_command_line_arguments() self.screen = pygame.display.set_mode((args.width, args.height)) self.screen_rect = self.screen.get_rect() pygame.display.set_caption("Place Pictures") pygame.key.set_repeat(100, 100) self.map = maps.Map(self) self.map.create_map(2000, 2000, 0, 0, 0) self.gui = gui.Gui(self) self.pictures = pictures.Pictures(self) self.mouse = mouse.Mouse() self.savegame = savegame.Savegame(self) pygame.display.flip()
def __init__(self,screen,cursor, clock, padre): resource.set_images_path(os.path.join("imagenes", "compartir")) self.background = resource.get_image("fondoCompartir.png") imgBtnEnviar = resource.get_image("botonEnviar.png") imgBtnEnviarSelec = resource.get_image("BotonesEnviar_selec.png") self.btnEnviar = Boton.Boton(imgBtnEnviar, imgBtnEnviarSelec, 700,550) self.screen = screen self.clock = clock self.tablero = padre self.mouse = mouse.Mouse() self.cursor = cursor self.inicio = True self.juego = False self.terminar = False self.envio = False self.letreroEnvio = False self.letreroNoEnvio = False self.CamposVacios = False self.tb1 = TextBox(position=(460,250),size=(400,25),textsize=22,editable=False) self.tb2 = TextBox(position=(460,300),size=(400,25),textsize=22,editable=False) self.contendora = textBox2.Contenedora() rutaFuente = os.path.join("fuentes", "PatrickHand-Regular.ttf") self.font = pygame.font.Font(rutaFuente, 22) self.img=self.font.render("Nombre: ",1,(0,0,0)) self.img2=self.font.render("Colegio: ",1,(0,0,0)) self.img3=self.font.render("Mensaje: ",1,(0,0,0)) resource.set_images_path(os.path.join("imagenes")) imgBtnRegresar = resource.get_image("boton_regresar.png") imgBtnRegresarSelec = resource.get_image("boton_regresar_selec.png") self.background2 = resource.get_image("Fondo.jpg", False) self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec, (1200 - 214 - 10), 10) self.msjInicio = MensajeEmergente.MensajeInicial(30, "Compartir") self.msjVacios = MensajeEmergente.MensajeInicial(30, "Compartir2") self.msjNoEnvio = MensajeEmergente.MensajeInicial(30, "Compartir3") self.msjEnvio = MensajeEmergente.MensajeInicial(30, "Compartir4")
def test(cont): '''This is used to test the camera class from Camera.blend. It checks to see if the game object exists, and if it does not, runs the camera''' # If the camera object does not exist, create it if 'CAMERA' not in cont.owner: cont.owner['MOUSE'] = mouse.Mouse() cont.owner['CAMERA'] = camera.Camera(cont.owner, defs.CAMERA_CONFIG) cont.owner.scene.active_camera = cont.owner['CAMERA'].camera bge.render.showMouse(True) else: # Otherwise run it with the status of the mouse click as a test # input cont.owner['MOUSE'].update() cont.owner['CAMERA'].update(cont.owner['MOUSE'].drag_delta, cont.owner['MOUSE'].scroll_delta)
def __init__(self): self.current_stage_index = 0 self.stages = [ click_bank_box.ClickBankBox(self), click_deposit.ClickDeposit(self) ] if config.MAGIC_LOGS else [ click_banker.ClickBanker(self), click_bank_option.ClickBankOption(self), click_deposit.ClickDeposit(self) ] self.mouse = mouse.Mouse() self.exit = False self.settled = True
def __init__(self): #Constantes de controle #comandos: [click, duplo_click, rolar_pagina_cima, rolar_pagina_baixo, sem_acao, click_contrario, atalho_alt_tab] #emocoes = ['Raiva', 'Desgosto', 'Medo', 'Felicidade', 'Tristeza', 'Surpresa', 'Neutro'] self.emocoes = [ "raiva", "desgosto", "medo", "felicidade", "tristeza", "surpresa", "neutro" ] self.FRAMES_VELOCIDADE = 30 #Carregando as configuracoes self.FACES_CALIBRAGEM = 20 self.LOTE_IMAGENS = 15 self.SEQUENCIA_EXPRESSOES = [] self.DIMENSAO = 30 #Definicoes dos arquivso externos de configuracao self.PATH_MODEL = "./model/modelo_cnn_major_20_10.h5" self.PATH_SETUP = "setup.txt" print("Carregando arquivos:\n") #Carrega modelos do OpenCV para detectar #FACE self.face_cascade = cv.CascadeClassifier( cv.data.haarcascades + "haarcascade_frontalface_alt.xml") print("- modelos do OpenCV") # Carregando modelos de aprendidos CNN print("- - compilando modelo \n") self.model = load_model(self.PATH_MODEL) self.model.compile print("- arquivo de configurações") self.COMANDOS = cfg.lerArquivoConfiguracoes() print(self.COMANDOS) #Instanciando Camera self.camera = camera.Camera() if camera != None: (self.xi_cabeca, self.yi_cabeca) = self._calibra_posicao_inicial_cabeca( camera, self.FACES_CALIBRAGEM) #Instanciando Mouse self.mouse = mouse.Mouse(self.xi_cabeca, self.yi_cabeca, self.DIMENSAO) #Instanciando Teclado self.teclado = teclado.Teclado()
def probeHW(self, skipMouseProbe=0, logFunc=None, forceDriver=None): self.videohw = videocard.VideoCardInfo(forceDriver=forceDriver) if self.videohw and self.videohw.primaryCard(): cardstr = self.videohw.primaryCard().getDescription() else: cardstr = _("Unable to probe") cardstr = _("Probing for video card: %s") % (cardstr, ) if logFunc is None: print cardstr else: logFunc(cardstr) self.monitorhw = monitor.MonitorInfo() self.mousehw = mouse.Mouse(skipProbe=skipMouseProbe)
def __init__(self, scene, conf): super().__init__(conf) logging.basicConfig(level=config.get('SYS/LOG_LEVEL'), format='%(message)s') if config.get('SYS/EXIT_ON_ERROR'): self.log.info("exit_with_error_enabled") sys.excepthook = err else: sys.excepthook = sys.__excepthook__ for cb in gc.callbacks.copy(): gc.callbacks.remove(cb) gc.callbacks.append(gc_notify) exit_key = config.get('KEYS/EMERGENCY_ABORT_KEY') if exit_key: bge.logic.setExitKey(bge.events.__dict__[exit_key]) self.log.info(self.M("init_game")) self._event = scheduler.Event(self.update) scheduler.add_event(self._event) bge.logic.addScene('HUD') self.scene = scene self.hud = None self.hud_scene = None self.hero = ship.Ship(self.scene.objects['HeroShipMain'], self.config['HERO_CONFIG']) self.camera = camera.Camera(self.scene.objects['MainCamera'], self.config['CAMERA_CONFIG']) self.mouse = mouse.Mouse(self.config['MOUSE_CONFIG']) self.environment = environment.Environment( self.scene.objects['LightRig'], self.scene.objects['TerrainTiles'], self.scene.objects['SkySphere'], ) self.scene.objects['MainCamera'].setParent(self.hero.vert_center) self.camera.set_view(0.5, -0.5, 0.2) self.navigation_waypoints = [] self.scene.active_camera = self.camera.camera bge.render.showMouse(True)
#Load random labyrinth with open("labyrinths.json", "r") as file: level = json.load(file) file.close() randomly_selected_level = random.randrange(len(level)) labyrinth = numpy.array(level[randomly_selected_level]["lab"]) starting_point = tuple(level[randomly_selected_level]["start"]) finish = tuple(level[randomly_selected_level]["end"]) #Create Mouse object and set it postion Micromouse = mouse.Mouse(pygame.image.load(os.path.join('sprite', 'player_2.png'))) Micromouse.rect.x , Micromouse.rect.y = 30*starting_point[0],30*starting_point[1] #Main loop window_open = True while window_open: #Event loop for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: window_open = False elif event.type == pygame.QUIT: window_open = False #Micromouse movement Micromouse.get_event(event)
def DR_off(): input_buffer = 2 * 1024 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("131.215.103.230", 4000)) cmd = "SOURce1:WAVeform \"0_2000MHz_DR_off\"" + "\n" s.send(cmd) s.close() ##################################### wait_time = averages / repetition_rate mouse1 = mouse.Mouse() def start_acquisition(): mouse1.invisible_click((1137, 775)) #click single def save_file(filename): time.sleep(1) keypress.PressKey(0x12) #alt keypress.ReleaseKey(0x12) #~alt #click file keypress.PressKey(0x28) #down keypress.ReleaseKey(0x28)
import processor import ram import storage import display import keyboard import mouse import computer processor = processor.Processor('3.4 GHz', 2) ram = ram.Ram(500) storage = storage.Storage(5000) display = display.Display('LG', '1920x1080') keyboard = keyboard.Keyboard('Samsung') mouse = mouse.Mouse('Apple') class ComputerBuilder: def build(self): return computer.Computer(processor, ram, storage, display, keyboard, mouse)
import mouse import heatmap import path import pathplanning import wall #-----include std libraries----- import math #-----include extends libraries import numpy as np if __name__ == '__main__': # int main()みたいな rospy.init_node("node_name") # ノード設定 #-----object等の定義----- cell_matrix = [17, 17] cell_size = [0.200, 0.200] mouse = mouse.Mouse() walls = wall.wallPublisher("wall_marker", cell_matrix, cell_size) path = path.pathPublisher("path_red", cell_size) #-----User定義変数----- PI = math.pi vl = vr = dire = 0 px = py = 1 action = -1 map_data = walls.getEmptyMazeMap(cell_matrix) map_data_colored = np.zeros(cell_matrix, dtype=int) try: loop = rospy.Rate(10) # 10[loop/s]の設定をする。 while not rospy.is_shutdown(): #-----ここにプログラムを書く-----
import config import mouse import pickle import time if __name__ == '__main__': print("Loading vectors") mouse_paths = pickle.load(open(config.MOUSE_VECTORS_FILENAME, "rb")) if len(mouse_paths) < 3: print("Record some mouse paths first") exit(0) print("Done.") m = mouse.Mouse() for mouse_path in mouse_paths: m.move_using_path(mouse_path, (0, 0), (800, 800)) time.sleep(0.5)
import serial #import serial library, to talk to SIM mainframe import time #import time library to define wait times import numpy as np #import numpy library to define arrays import mouse #import mouse library, to use mouse clicking routine step = 100.0 #desired comb step size in Hz time_sleep = 225 #desired rest time at each step in seconds mouse1 = mouse.Mouse() #calls the mouse clicker routine in the mouse library def start_acquisition(): mouse1.invisible_click((1728, 79)) #single click on start aquisition button in AlazarTech program #AlazarTech program must be maximized for click coordinates to work def save_file(): #this routine executes a series of clicks to save data files mouse1.invisible_click((15, 31)) time.sleep(0.5) #single click file menu mouse1.invisible_click((24, 79)) time.sleep(1.0) #single click save as mouse1.invisible_click((928, 461)) time.sleep(0.5) #single click to select channel B as the channel to save mouse1.invisible_click((1034, 763)) time.sleep(3.0) #single click ok to save in window mouse1.invisible_click((1103, 571)) #single click ok to clear save complete message def move_comb(voltage): #this routine sets the output voltage of the PID controller
import concurrent.futures as cf import os import keyboard import mouse import system import window import gui if __name__ == "__main__": #x = input("Write over old data? (y/n) ") x = 'y' msg = "testing thread from main.py" kb = keyboard.Keyboard(erase=x) mo = mouse.Mouse(erase=x) sy = system.System(erase=x) wn = window.Window(erase=x) dash = gui.Gui() th0 = th.Thread(target=kb.data_stream, daemon=True) th1 = th.Thread(target=mo.data_stream, daemon=True) th2 = th.Thread(target=sy.data_stream, daemon=True) th3 = th.Thread(target=wn.data_stream, daemon=True) try: """ with cf.ThreadPoolExecutor() as exe: th1 = exe.submit(kb.data_stream) th2 = exe.submit(mo.data_stream) th3 = exe.submit(sy.data_stream) th4 = exe.submit(wn.data_stream)
import roslib.packages pk_path = roslib.packages.get_pkg_dir('micro_mouse') import sys sys.path.append(pk_path + '/script/lib') import math import rospy # include<ros/ros.h>のようなもの import mouse if __name__ == '__main__': # int main()みたいな rospy.init_node("node_name") # ノード設定 mouse = mouse.Mouse( "cmd_vel", ["scan/R", # 0 センサの管理番号 "scan/FR", # 1 "scan/F", # 2 "scan/FL", # 3 "scan/L"]) # 4 #-----変数定義----- # mouseには5つのセンサが搭載されています。 # それぞれのセンサ値を管理するための配列変数sensorを定義する。 sensor = [0 for i in range( 5)] #-----変数定義終了----- try: loop = rospy.Rate(10) # 10[loop/s]の設定をする。 while not rospy.is_shutdown(): #-----ここにプログラムを書く----- #-----センサー読み込み----- # mouse.sensor[管理番号]で、壁までの「距離」が取得できる。 # また、(距離 < 1.0)で、[距離]を[ブール値]に変える
def start_acquisition(): #this routine clicks the acquire data button to start a scan mouse1 = mouse.Mouse() #defines the mouseclicker routine mouse1.invisible_click((1728,79))
import threading import mouse as ms import os import shutil import time from selenium import webdriver from selenium.webdriver.firefox.options import Options import window as wnd import bot as b if os.path.exists('sketch.png'): os.remove('sketch.png') shutil.copy('default.png', 'sketch.png') options = Options() # options.add_argument("--headless") driver = webdriver.Firefox(firefox_options=options) driver.set_window_size(1366, 768) # 1354 x 687 driver.get( 'https://standalone-proxy-prod.wsop.playtika.com/355-39865c8869b30965052f6ebfc21b98bc2044f586/index.html' ) # https://www.pointerpointer.com/ # window = wnd.Window(driver) # window.start() mouse = ms.Mouse(driver) bot = b.Bot(mouse, driver) bot.main() # bot.start() # print('CLICKED') # mouse.click((953, 550)) # driver.quit()
import Back as b import mouse as m import cloud as cl import game as g todas_as_sprites = pygame.sprite.Group() cat = c.Cat() back = b.Back() todas_as_sprites.add(back) todas_as_sprites.add(cat) for i in range(3): cloud = cl.Cloud() todas_as_sprites.add(cloud) mouse1 = m.Mouse() mouse2 = m.Mouse() mouse3 = m.Mouse() mouse4 = m.Mouse() todas_as_sprites.add(mouse1, mouse2, mouse3, mouse4) grupo_obstaculos = pygame.sprite.Group() grupo_obstaculos.add(mouse1, mouse2, mouse3, mouse4) grupo_oM1 = pygame.sprite.Group() grupo_oM1.add(mouse2, mouse3, mouse4) grupo_oM2 = pygame.sprite.Group() grupo_oM2.add(mouse1, mouse3, mouse4)
import roslib.packages pk_path = roslib.packages.get_pkg_dir('micro_mouse') import sys sys.path.append(pk_path + '/script/lib') import math import rospy # include<ros/ros.h>のようなもの import mouse if __name__ == '__main__': # int main()みたいな rospy.init_node("node_name") # ノード設定 mouse = mouse.Mouse("cmd_vel", ["scan/R", "scan/FR", "scan/F", "scan/FL", "scan/L"]) #-----変数定義----- # mouseには5つのセンサが搭載されています。 # それぞれのセンサ値を管理するための配列変数sensorを定義する。 sensor = [0 for i in range(5)] vl = vr = 0 #-----変数定義終了----- try: loop = rospy.Rate(10) # 10[loop/s]の設定をする。 while not rospy.is_shutdown(): #-----ここにプログラムを書く----- #-----センサー読み込み----- # mouse.sensor[ 管理番号 ] で、壁までの「距離」が取得できる。 # また、 ( 距離 < 1.0) で、 [ 距離 ] を [ ブール値 ] に変える for i in range(5):
def __init__(self): self.mouse = mouse.Mouse() pass