<jupyter_start><jupyter_text>mouse and adv<jupyter_code>import cv2
import numpy as np
colors = {'blue': (255, 0, 0), 'green': (0, 255, 0), 'red': (0, 0, 255), 'yellow': (0, 255, 255),
          'magenta': (255, 0, 255), 'cyan': (255, 255, 0), 'white': (255, 255, 255), 'black': (0, 0, 0),
          'gray': (125, 125, 125), 'rand': np.random.randint(0, high=256, size=(3,)).tolist(),
          'dark_gray': (50, 50, 50), 'light_gray': (220, 220, 220)}
def draw_text():
    
    menu_pos1 = (10, 500)
    menu_pos2 = (10, 525)
    menu_pos3 = (10, 550)
    menu_pos4 = (10, 575)
    
    cv2.putText(image, 'Double left click: add a circle', menu_pos1, cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255))
    cv2.putText(image, 'Simple right click: delete last circle', menu_pos2, cv2.FONT_HERSHEY_SIMPLEX, 0.7,
                (255, 255, 255))
    cv2.putText(image, 'Double right click: delete all circle', menu_pos3, cv2.FONT_HERSHEY_SIMPLEX, 0.7,
                (255, 255, 255))
    cv2.putText(image, 'Press \'q\' to exit', menu_pos4, cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255))
    
def draw_circle(event,x,y,flags,parameters):
    
    global circles
    
    if event==cv2.EVENT_RBUTTONDBLCLK:
        print("event:EVENT_RBUTTONDBLCLK")
        circles[:]=[]
    if event==cv2.EVENT_LBUTTONDBLCLK:
        print("event:EVENT_LBUTTONDBLCLK")
        circles.append((x,y))
    if event==cv2.EVENT_RBUTTONDOWN:
        print("event:EVENT_RBUTTONDOWN")
        try:
            circles.pop()
        except(IndexError):
            print("there is no circles")
    if event==cv2.EVENT_MOUSEMOVE:
        print("event:EVENT_MOUSEMOVE")
circles=[]
image=np.zeros((600,600,3),dtype="uint8")
cv2.namedWindow("mouse events")
cv2.setMouseCallback("mouse events",draw_circle)
draw_text()
dup=image.copy()
while True:
    image=dup.copy()
    #c=tuple([np.random.randint(255),np.random.randint(255),np.random.randint(255)])
    for positions in circles:
        c=tuple([np.random.randint(255),np.random.randint(255),np.random.randint(255)])
        cv2.circle(image,positions,10,c,-1)
    cv2.imshow("mouse events",image)
    if cv2.waitKey(20) & 0xFF == ord('q'):
        break
cv2.destroyAllWindows()<jupyter_output>event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVENT_MOUSEMOVE
event:EVEN[...]
{'fraction_non_alphanumeric': 0.13291925465838508, 'fraction_numerical': 0.062111801242236024, 'mean_word_length': 4.931860036832412, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '280177', 'license': 'MIT', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1260, 'n_words': 217, 'path': 'mouse events/mouse events.ipynb', 'repo_name': 'akkinasrikar/Opencv', 'size': '3220'}