SHARE
TWEET

Untitled

KreeZe Nov 11th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pygame
  2. def fin():
  3.     launched = True
  4.     while launched:
  5.         for event in pygame.event.get():
  6.             if event.type == pygame.QUIT:
  7.                 launched = False
  8.  
  9.     if event.type == pygame.QUIT:
  10.         pygame.quit()
  11.  
  12. def text1(word,x,y):
  13.     pygame.init()
  14.     blank_color = (255, 255, 255)
  15.     fenetre = pygame.display.set_mode((1366, 768))
  16.     font=pygame.font.Font(None, 24)
  17.     text = font.render(word,1,(255,255,255))
  18.  
  19.     fenetre.blit(text, (x, y))
  20.     pygame.display.flip()
  21.  
  22.  
  23.  
  24. def inpt():
  25.  
  26.     word=""
  27.     text1("Please enter your name: ",300,400) #example asking name
  28.     done = True
  29.     while done==True:
  30.         for event in pygame.event.get():
  31.             if event.type==pygame.QUIT:
  32.                 pygame.quit()
  33.                 quit()
  34.             if event.type == pygame.KEYDOWN:
  35.                 if event.key == pygame.K_q:
  36.                     word+="a"
  37.                     text1(word,300,400)
  38.                 if event.key == pygame.K_b:
  39.                     word+=chr(event.key)
  40.                     text1(word,300,400)
  41.                 if event.key == pygame.K_c:
  42.                     word+=chr(event.key)
  43.                     text1(word,300,400)
  44.                 if event.key == pygame.K_d:
  45.                     word+=chr(event.key)
  46.                     text1(word,300,400)
  47.                 if event.key == pygame.K_e:
  48.                     word+=chr(event.key)
  49.                     text1(word,300,400)
  50.                 if event.key == pygame.K_a:
  51.                     word+="q"
  52.                     text1(word,300,400)
  53.                 if event.key == pygame.K_RETURN:
  54.                     done=False
  55.                 if event.type==pygame.QUIT:
  56.                     pygame.quit()
  57.  
  58.  
  59.     return text1(word,300,400)
  60.  
  61. inpt()
  62.  
  63.  
  64.  
  65. fin()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top