Oct-19-2023, 06:29 AM
hey guys,
in advance: I'm new in PyGame.
I'm working on a photo booth / photo box with the software "PiBooth" - https://github.com/pibooth/pibooth.
It is possible to create your own plugins – hooks in different states. I created a plugin that displays a screen when the Photo Booth printer needs to be refilled:
When the print counter reaches the refill level (after 38 prints), a message should appear with a “Done” button or something similar.
My problem is: I don't know how to display the screen UNTIL user input.
Here the code:
in advance: I'm new in PyGame.
I'm working on a photo booth / photo box with the software "PiBooth" - https://github.com/pibooth/pibooth.
It is possible to create your own plugins – hooks in different states. I created a plugin that displays a screen when the Photo Booth printer needs to be refilled:
When the print counter reaches the refill level (after 38 prints), a message should appear with a “Done” button or something similar.
My problem is: I don't know how to display the screen UNTIL user input.
Here the code:
@pibooth.hookimpl def state_wait_do(win, app, events): #and app.print_ok != 0 and app.find_print_event(events).printer == 1 if app.find_print_event(events) != None: LOGGER.info("sate_print_do") printed = app.count.printed if((printed % 38) == 0): text = "Bitte Transferrolle wechseln und Papier auffuellen, 38 gedruckte Bilder.\n\nStatus Drucker:\n" sendstatusmail("Transferrolle wechseln und Papier auffuellen", text) win_rect = win.get_rect() text = "Bitte warten..." font = fonts.get_pygame_font(text, fonts.CURRENT, win_rect.width//1.5, win_rect.height//1.5) text_surface = font.render(text, True, win.text_color) if isinstance(win.bg_color, (tuple, list)): win.surface.fill(win.bg_color) else: bg_surface = pictures.get_pygame_image(win.bg_color, win_rect.size, crop=True, color=None) win.surface.blit(bg_surface, (0, 0)) win.surface.blit(text_surface, text_surface.get_rect(center=win_rect.center).topleft) pygame.display.update() pygame.event.pump() n = 0 gef = False #time.sleep(5) while True: time.sleep(5) if gef: break events = pygame.event.get() print(n) n = n + 1 m = 0 for event in events: print(str(n) + str(m)) print(event) if event.type == pygame.KEYDOWN: print("Jetzat") gef = True