Oct-02-2017, 06:45 PM
Hey Game Programmers and Software Developers...
I try to create tekst with an input, so you can typ any thing on your keyboard,
and it render into the pygame window... but it don't works...
This is my script:
or user of my program can input the text from the keyboard ?...
Thanks for help, Jamie.
I try to create tekst with an input, so you can typ any thing on your keyboard,
and it render into the pygame window... but it don't works...
This is my script:
import pygame import sys pygame.init() WHITE = (255, 255, 255) RED = (0, 255, 0) BLACK = (0, 0, 0) size = (640, 480) screen = pygame.display.set_mode(size) pygame.display.set_caption("JCads Develop") done = False clock = pygame.time.Clock() while not done: for event in pygame.event.get(): if event.type == pygame.QUIT: done = True elif event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: done = True screen.fill(WHITE) pygame.draw.line(screen, RED, [0, 0], [100, 100], 5) font = pygame.font.SysFont('Calibri', 25, True, False) text = font.render(input("Your Name: "), True, BLACK) screen.blit(text, [250, 250]) pygame.display.flip() clock.tick(60) pygame.quit() sys.exit()Can anyone help me to give an example, about how i can give text an input, just an player
or user of my program can input the text from the keyboard ?...
Thanks for help, Jamie.