<s> import sys <EOL> import os <EOL> sys . path . append ( os . path . abspath ( '<STR_LIT:..>' ) ) <EOL> import pygcurse , pygame <EOL> from pygame . locals import * <EOL> win = pygcurse . PygcurseWindow ( <NUM_LIT> , <NUM_LIT> ) <EOL> win . autoblit = False <EOL> box = pygcurse . PygcurseTextbox ( win , ( <NUM_LIT:4> , <NUM_LIT:4> , <NUM_LIT:20> , <NUM_LIT> ) , fgcolor = '<STR_LIT>' , bgcolor = '<STR_LIT>' , border = '<STR_LIT>' , wrap = True , marginleft = <NUM_LIT:3> , caption = '<STR_LIT>' ) <EOL> box . text = '<STR_LIT>' <EOL> eraseBox = False <EOL> while True : <EOL> for event in pygame . event . get ( ) : <EOL> if event . type == QUIT or event . type == KEYDOWN and event . key == K_ESCAPE : <EOL> pygame . quit ( ) <EOL> sys . exit ( ) <EOL> if event . type == KEYDOWN : <EOL> if event . key == K_UP : <EOL> box . height -= <NUM_LIT:1> <EOL> elif event . key == K_DOWN : <EOL> box . height += <NUM_LIT:1> <EOL> elif event . key == K_LEFT : <EOL> box . width -= <NUM_LIT:1> <EOL> elif event . key == K_RIGHT : <EOL> box . width += <NUM_LIT:1> <EOL> elif event . key == K_w : <EOL> box . y -= <NUM_LIT:1> <EOL> elif event . key == K_s : <EOL> box . y += <NUM_LIT:1> <EOL> elif event . key == K_a : <EOL> box . x -= <NUM_LIT:1> <EOL> elif event . key == K_d : <EOL> box . x += <NUM_LIT:1> <EOL> elif event . key == K_r : <EOL> box . x = <NUM_LIT:4> <EOL> box . y = <NUM_LIT:4> <EOL> box . width = <NUM_LIT:20> <EOL> box . height = <NUM_LIT> <EOL> elif event . key == K_p : <EOL> win . fullscreen = not win . fullscreen <EOL> elif event . key == K_d : <EOL> win . _debugchars ( ) <EOL> elif event . key == K_m : <EOL> eraseBox = not eraseBox <EOL> elif event . key == K_f : <EOL> win . height = <NUM_LIT:30> <EOL> win . setscreencolors ( '<STR_LIT>' , '<STR_LIT>' , clear = True ) <EOL> box . update ( ) <EOL> if eraseBox : <EOL> box . erase ( ) <EOL> win . cursor = <NUM_LIT:0> , win . height - <NUM_LIT:3> <EOL> win . pygprint ( '<STR_LIT>' ) <EOL> win . cursor = <NUM_LIT:0> , win . height - <NUM_LIT:1> <EOL> win . putchars ( '<STR_LIT>' % ( box . x , box . y , box . width , box . height ) ) <EOL> win . blittowindow ( ) </s>
