import pygame from pygame import * global small_letters global big_letters global all_keys small_letters="abcdefghijklmnopqrstuvwxyz`1234567890-=[];',./\ " big_letters='ABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()_+{}:"<>?| ' all_keys=[pygame.K_a, pygame.K_b, pygame.K_c, pygame.K_d, pygame.K_e, pygame.K_f, pygame.K_g, pygame.K_h, pygame.K_i, pygame.K_j, pygame.K_k, pygame.K_l, pygame.K_m, pygame.K_n, pygame.K_o, pygame.K_p, pygame.K_q, pygame.K_r, pygame.K_s, pygame.K_t, pygame.K_u, pygame.K_v, pygame.K_w, pygame.K_x, pygame.K_y, pygame.K_z, pygame.K_BACKQUOTE,pygame.K_1, pygame.K_2, pygame.K_3, pygame.K_4, pygame.K_5, pygame.K_6, pygame.K_7, pygame.K_8, pygame.K_9, pygame.K_0, pygame.K_MINUS, pygame.K_EQUALS, pygame.K_LEFTBRACKET, pygame.K_RIGHTBRACKET, pygame.K_SEMICOLON, pygame.K_QUOTE, pygame.K_COMMA, pygame.K_PERIOD, pygame.K_SLASH, pygame.K_BACKSLASH, pygame.K_SPACE] def main(): pygame.init() message="" global screen screen = pygame.display.set_mode((500, 500)) pygame.display.set_caption("Eskimo Tutorial") screen.fill([0,0,0]) font = pygame.font.Font(None, 25) # teal = 64,255,248 # yellow = 240,255,0 clock = pygame.time.Clock() letter_type="s" caps=False shift=False counter=0 while 1: clock.tick(50) counter += 1 if counter == 1000: print "time is out :)" raise crashExit for event in pygame.event.get(): if event.type==KEYDOWN: if not event.key==K_LSHIFT: shift=False if event.key==K_LSHIFT: shift=True for e in range(len(all_keys)): if event.key==all_keys[e]: if letter_type=="b": message=message+big_letters[e] else: message=message+small_letters[e] if event.key==K_BACKSPACE: message=message[:-1] if shift==True: print "---###>>>\nShifting\n<<<###---" letter_type="b" else: print "!!!!!!NOT SHIFTING@@@@@@@@@@" letter_type="s" print message pygame.display.flip() a = 1 if a == 1: main()