<s> '''<STR_LIT>''' <EOL> __docformat__ = '<STR_LIT>' <EOL> __version__ = '<STR_LIT>' <EOL> import sys <EOL> from pyglet . window import key <EOL> from pyglet . window import mouse <EOL> class WindowExitHandler ( object ) : <EOL> '''<STR_LIT>''' <EOL> has_exit = False <EOL> def on_close ( self ) : <EOL> self . has_exit = True <EOL> def on_key_press ( self , symbol , modifiers ) : <EOL> if symbol == key . ESCAPE : <EOL> self . has_exit = True <EOL> class WindowEventLogger ( object ) : <EOL> '''<STR_LIT>''' <EOL> def __init__ ( self , logfile = None ) : <EOL> '''<STR_LIT>''' <EOL> if logfile is None : <EOL> logfile = sys . stdout <EOL> self . file = logfile <EOL> def on_key_press ( self , symbol , modifiers ) : <EOL> print >> self . file , '<STR_LIT>' % ( <EOL> key . symbol_string ( symbol ) , key . modifiers_string ( modifiers ) ) <EOL> def on_key_release ( self , symbol , modifiers ) : <EOL> print >> self . file , '<STR_LIT>' % ( <EOL> key . symbol_string ( symbol ) , key . modifiers_string ( modifiers ) ) <EOL> def on_text ( self , text ) : <EOL> print >> self . file , '<STR_LIT>' % text <EOL> def on_text_motion ( self , motion ) : <EOL> print >> self . file , '<STR_LIT>' % ( <EOL> key . motion_string ( motion ) ) <EOL> def on_text_motion_select ( self , motion ) : <EOL> print >> self . file , '<STR_LIT>' % ( <EOL> key . motion_string ( motion ) ) <EOL> def on_mouse_motion ( self , x , y , dx , dy ) : <EOL> print >> self . file , '<STR_LIT>' % ( <EOL> x , y , dx , dy ) <EOL> def on_mouse_drag ( self , x , y , dx , dy , buttons , modifiers ) : <EOL> print >> self . file , '<STR_LIT>' '<STR_LIT>' % ( <EOL> x , y , dx , dy , <EOL> mouse . buttons_string ( buttons ) , key . modifiers_string ( modifiers ) ) <EOL> def on_mouse_press ( self , x , y , button , modifiers ) : <EOL> print >> self . file , '<STR_LIT>' '<STR_LIT>' % ( x , y , <EOL> mouse . buttons_string ( button ) , key . modifiers_string ( modifiers ) ) <EOL> def on_mouse_release ( self , x , y , button , modifiers ) : <EOL> print >> self . file , '<STR_LIT>' '<STR_LIT>' % ( x , y , <EOL> mouse . buttons_string ( button ) , key . modifiers_string ( modifiers ) ) <EOL> def on_mouse_scroll ( self , x , y , dx , dy ) : <EOL> print >> self . file , '<STR_LIT>' % ( <EOL> x , y , dx , dy ) <EOL> def on_close ( self ) : <EOL> print >> self . file , '<STR_LIT>' <EOL> def on_mouse_enter ( self , x , y ) : <EOL> print >> self . file , '<STR_LIT>' % ( x , y ) <EOL> def on_mouse_leave ( self , x , y ) : <EOL> print >> self . file , '<STR_LIT>' % ( x , y ) <EOL> def on_expose ( self ) : <EOL> print >> self . file , '<STR_LIT>' <EOL> def on_resize ( self , width , height ) : <EOL> print >> self . file , '<STR_LIT>' % ( width , height ) <EOL> def on_move ( self , x , y ) : <EOL> print >> self . file , '<STR_LIT>' % ( x , y ) <EOL> def on_activate ( self ) : <EOL> print >> self . file , '<STR_LIT>' <EOL> def on_deactivate ( self ) : <EOL> print >> self . file , '<STR_LIT>' <EOL> def on_show ( self ) : <EOL> print >> self . file , '<STR_LIT>' <EOL> def on_hide ( self ) : <EOL> print >> self . file , '<STR_LIT>' <EOL> def on_context_lost ( self ) : <EOL> print >> self . file , '<STR_LIT>' <EOL> def on_context_state_lost ( self ) : <EOL> print >> self . file , '<STR_LIT>' <EOL> def on_draw ( self ) : <EOL> print >> self . file , '<STR_LIT>' </s>
