#NEWLINE# def on_mouse( self , event , x , y , flags , param ) : #NEWLINE# #INDENT# if ( event == cv . CV_EVENT_LBUTTONDOWN ) : #NEWLINE# #INDENT# self . drag_start = ( x , y ) #NEWLINE# #UNINDENT# if ( event == cv . CV_EVENT_LBUTTONUP ) : #NEWLINE# #INDENT# self . drag_start = None #NEWLINE# self . track_window = self . selection #NEWLINE# #UNINDENT# if self . drag_start : #NEWLINE# #INDENT# xmin = min ( x , self . drag_start [ 0 ] ) #NEWLINE# ymin = min ( y , self . drag_start [ 1 ] ) #NEWLINE# xmax = max ( x , self . drag_start [ 0 ] ) #NEWLINE# ymax = max ( y , self . drag_start [ 1 ] ) #NEWLINE# self . selection = ( xmin , ymin , ( xmax - xmin ) , ( ymax - ymin ) )