firstInstrument.instrument_update(firstInstrumentdegAngle) secondInstrument.instrument_update(secondInstrumentdegAngle) thirdInstrument.instrument_update(thirdInstrumentdegAngle) fourthInstrument.instrument_update(fourthInstrumentdegAngle) blit_idx() # check for events, [quit, mouse click] for event in pygame.event.get(): if event.type == pygame.locals.QUIT: pygame.quit() sys.exit() # reset the instruments elif event.type == pygame.MOUSEBUTTONDOWN and event.button == RIGHT: print 'Restart' firstInstrument.reset_parameters() secondInstrument.reset_parameters() thirdInstrument.reset_parameters() fourthInstrument.reset_parameters() # trig the instruments elif event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: pygame.quit() sys.exit() elif event.key == pygame.K_3: thirdInstrument.set_flag(True) inputData = 6.8 thirdInstrumentdegAngle = -20*inputData + 220
# draw center circle and blit index number in instrument pygame.draw.circle(screen, RED1, (250,150), 15, 0) pygame.draw.circle(screen, BLACK, (250,150), 5, 0) blit_idx() # check for events, [quit, mouse click] for event in pygame.event.get(): if event.type == pygame.locals.QUIT: pygame.quit() sys.exit() # reset the instruments elif event.type == pygame.MOUSEBUTTONDOWN and event.button == RIGHT: print 'Restart' firstInstrument.reset_parameters() #secondInstrument.reset_parameters() # trig the instruments elif event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: pygame.quit() sys.exit() # set instrument 1 and 2 via mouse position elif event.type == pygame.MOUSEMOTION: # the factor 107: k = (1400-1) / (12-1) # the factor 46: k = (600-1) / (12-1) # The size of the window is 1400x600