# Imports
import pygame_textinput
import pygame
# Set Up
pygame.init()
# Class
def textinput():
    # Window
    screen = pygame.display.set_mode((300, 50))
    pygame.display.set_caption("Enter level number")
    # Set Up
    textinput = pygame_textinput.TextInput()
    clock = pygame.time.Clock()
    # Game Loop
    run = True
    while run:
        # Background
        screen.fill((225, 225, 225))
        events = pygame.event.get()
        # QUIT
        for event in events:
            if event.type == pygame.QUIT:
                exit()
        # Feed Events
        if textinput.update(events):
            run = False
            return textinput.get_text()
        # Output
        screen.blit(textinput.get_surface(), (10, 10))
        # Display
        pygame.display.update()
        clock.tick(30)