예제 #1
0
degAngle = -20.0
firstInstrument.set_needle_position(degAngle)
secondInstrument.set_needle_position(degAngle)
thirdInstrument.set_needle_position(degAngle)
fourthInstrument.set_needle_position(degAngle)

# input data that will set the final position of needle
inputData  = 0.0
mouseDataX = 0.0
mouseDataY = 0.0

while 1:
 
    # update each instrument
    screen.blit(background, bgRect)
    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()
예제 #2
0
secondInstrumentdegAngle = 0.0

# set instrument at start position
degAngle = -20.0
firstInstrument.set_needle_position(degAngle)
#secondInstrument.set_needle_position(degAngle)

# input data that will set the final position of needle
inputData  = 0.0
mouseDataX = 0.0
mouseDataY = 0.0

while 1:
    # update each instrument
    screen.blit(background, bgRect)
    firstInstrument.instrument_update(firstInstrumentdegAngle)
    #secondInstrument.instrument_update(secondInstrumentdegAngle)
   
    # 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: