#πŸ”’ inputted text in pygame not showing

8 messages Β· Page 1 of 1 (latest)

quiet arrowBOT
#

@rotund parrot

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

rotund parrot
#
# Importing pygame into the program
import pygame

# Activating pygame
pygame.init()

# CONSTANTS
#------------#
# Defining the size of the game window in pixels as constants.
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 900
# The rgb code for each color.
YELLOW = (255, 255, 0)
DARK_YELLOW = (254, 221, 0)
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))

user_name = ""
title_font = pygame.font.Font("fonts/game title.ttf", 150)
title_font_xs = pygame.font.Font("fonts/game title.ttf", 120)
name_font = pygame.font.Font("fonts/enter name.ttf", 80)
username_input = name_font.render(user_name, True, DARK_YELLOW)
name_background = pygame.image.load("images/darkened_background.png")
running: bool = True
type_name: bool = False
while running is True:
if type_name is True:
            screen.blit(name_background, (0, 0))
            screen.blit(enter_name, (20, 50))
            screen.blit(enter_name_2, (40, 190))
            screen.blit(username_input, (30, 260))
    for event in pygame.event.get():
        # If the user closes the window,
        if event.type == pygame.QUIT:
            # The loop ends,
            running = False
        if type_name is True:
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_BACKSPACE:
                    user_name = user_name[:-1]
                else:
                    user_name += event.unicode
    pygame.display.flip()
# Therefore moving onto the next bit of code, closing the window.
pygame.quit()
#

removed all the unnecessary code i think

unborn cedar
#

it's hard to read without the proper identation nor the proper formatter

rotund parrot
#

Sorry what’s the command for the proper formatter

quiet arrowBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

πŸ”’ inputted text in pygame not showing