Прикреплённый файл «pygame_2-1-0.py»

Загрузка

   1 #!/usr/bin/env python
   2 # -*- coding: UTF-8 -*-
   3 # vim: expandtab shiftwidth=4
   4 '''
   5 Проект "Построение графика", подзадача pygame 2-1-0
   6 редактор текстового ввода
   7 См. PyGameState_Input.dia
   8 '''
   9 import pygame, sys
  10 pygame.init()
  11 pygame.font.init()
  12 
  13 W,H=640,480
  14 screen=pygame.display.set_mode((W,H))
  15 
  16 pen,width=(10,100,200),2
  17 font = pygame.font.Font(None, W/40)
  18 
  19 def ScrInput(screen, prompt, pos):
  20     global Copy
  21     res = ""
  22     Copy = screen.copy()
  23     while True:
  24         text = font.render(prompt+": "+res, 1, (255,255,255))
  25         screen.blit(Copy, (0,0))
  26         screen.blit(text, pos)
  27         pygame.display.flip()
  28         event = pygame.event.wait()
  29         if event.type == pygame.KEYDOWN:
  30             if event.unicode:                     # real characters
  31                 if event.unicode == u"\033":      # ESC
  32                     res = None
  33                     break
  34                 elif event.unicode == "\010":     # Backspace
  35                     res=res[:-1]
  36                 elif event.unicode in u"\r\n":    # Enter
  37                     break
  38                 elif event.unicode > u" ":        # printable characters
  39                     res += event.unicode
  40                 #print event.unicode.__repr__()
  41     screen.blit(Copy, (0,0))
  42     pygame.display.flip()
  43     return res
  44 
  45 ScrInput(screen, "TEXT", (10,10))

Прикреплённые файлы

Для ссылки на прикреплённый файл в тексте страницы напишите attachment:имяфайла, как показано ниже в списке файлов. Не используйте URL из ссылки «[получить]», так как он чисто внутренний и может измениться.

Вам нельзя прикреплять файлы к этой странице.