示例#1
0
    altTrackID = 0  #ID of other random person
    gazeAtClosest = True
    pygame.time.set_timer(GAZEEVENT, 8000, True)  #Start gaze event
    videoKeys = []  #IDs of people present at last video showing
    prevKeys = []  #IDs of people present last iteration
    prevInteraction = 0  #What interaction scenario was last run
    #interactionWait = False #Indicate if waiting between interactions
    interactionIndex = 0  #What interaction was last run if repeat interaction scenario
    lastNumberOfActivations = 0  #Activation counter last iteration
    peopleAmount = 1  #len(trackedList)
    frequency = 1  #from trailing_five
    interactionItems = []  #Interaction stages
    runInteraction = False  #Turn on/off interactions (r button)

    # Initialize stats variables
    st = stattracker.StatTracker()

    oldNumberOfPeople = 0  #People counter last iteration
    numberOfPeople = 0  #People counter this iteration

    if largeScreen:
        ## Timer bubbles settings ##
        #Show photo of person who used dispenser
        showPhoto = False
        photoTimer = 0
        BubbleUpdate = 5  #Hz of trackeduser bubble update
        bubbles = []
        ## Set up infographic images ##
        showimages.imagesInit("images/info/")
        hScale = 1.2
    else:
import csv
import pygame

pygame.init()

if __name__ == '__main__':

    window = pygame.display.set_mode((800, 480), pygame.DOUBLEBUF)
    screen = pygame.display.get_surface()

    # Initialize dispenser
    dispenser = dispenser.Dispenser()
    dispenser.init_GPIO()

    # Initialize stats variables
    stats = stattracker.StatTracker()

    running = True
    while running:

        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_q:
                    running = False
                    print("Terminating program")
                if event.key == pygame.K_p:
                    plot_data, plot_size = stats.get_plot()
                    plot = pygame.image.fromstring(plot_data, plot_size, "RGB")
                    screen.blit(plot, (0, 0))
                    pygame.display.flip()
                    print("Plotting data")