<s> import pygame <EOL> from pygame . locals import * <EOL> from py2d . Math import * <EOL> from examples import Example <EOL> class Draw ( Example ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , runner ) : <EOL> self . runner = runner <EOL> self . title = "<STR_LIT>" <EOL> self . poly = Polygon ( ) <EOL> def update ( self , time_elapsed ) : <EOL> if self . runner . keys [ K_BACKSPACE ] and self . poly . points : <EOL> del ( self . poly . points [ len ( self . poly . points ) - <NUM_LIT:1> ] ) <EOL> self . runner . keys [ K_BACKSPACE ] = False <EOL> def render ( self ) : <EOL> if len ( self . poly ) > <NUM_LIT:1> : <EOL> pygame . draw . lines ( self . runner . screen , <NUM_LIT> , True , self . poly . as_tuple_list ( ) ) <EOL> elif self . poly . points : <EOL> pygame . draw . circle ( self . runner . screen , <NUM_LIT> , self . poly . points [ <NUM_LIT:0> ] . as_tuple ( ) , <NUM_LIT:2> ) <EOL> def mouse_down ( self , pos , button ) : <EOL> if button == <NUM_LIT:1> : <EOL> self . poly . add_point ( Vector ( pos [ <NUM_LIT:0> ] , pos [ <NUM_LIT:1> ] ) ) </s>
