import pygame
from random import randint
pygame.init()
#create a game window
clock = pygame.time.Clock()
back = (255, 255, 255) #background color
mw = pygame.display.set_mode((500, 500)) #main window
mw.fill(back)
#colors
BLACK = (0, 0, 0)
LIGHT_BLUE = (200, 200, 255)
class TextArea():
def __init__(self, x=0, y=0, width=10, height=10, color=None):
""" area: a rectangle in the right place and the right color """
#memorize the rectangle:
self.rect = pygame.Rect(x, y, width, height)
#fill color - either the passed parameter or the overall background color
self.fill_color = color
#place text
def set_text(self, text, fsize=12, text_color=BLACK):
self.text = text
self.image = pygame.font.Font(None, fsize).render(text, True, text_color)
#draw a rectangle with text
def draw(self, shift_x=0, shift_y=0):
pygame.draw.rect(mw, self.fill_color, self.rect)
mw.blit(self.image, (self.rect.x + shift_x, self.rect.y + shift_y))
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}