import tkinter
import random

#constant
WIDTH = 640
HEIGHT = 480
BG_COLOR = 'BLUE'

#mouse events
def mouse_click(event):
    global main_ball
    print(event.num, event.x, event.y)
    if event.num == 1:
        main_ball = Balls(event.x, event.y, 30, 'white')
        main_ball.draw()
    else:
        main_ball.hide()
    
    
#ball class
class Balls():
    def __init__(self, x, y, r, color, dx=0, dy=0):
        self.x = x
        self.y = y
        self.color = color
        self.r = r
        self.dx = dx
        self.dy = dy
    def draw(self):
        canvas.create_oval(self.x - self.r, self.y - self.r, self.x + self.r, self.y + self.r, fill=self.color)
    def hide(self):
        canvas.create_oval(self.x - self.r, self.y - self.r, self.x + self.r, self.y + self.r, fill=BG_COLOR,                   outline=BG_COLOR)
    def move(self):
        self.hide()
        self.x += self.dx
        self.y += self.dy
        self.draw()
    
        
    
#main cicle of game
    def main():
        if 'main_ball' in globals():
            main_ball.move()
    		root.after(10, main)
    

root = tkinter.Tk()
root.title('Dildo')
canvas = tkinter.Canvas(root, width=WIDTH, height=HEIGHT, bg=BG_COLOR)
canvas.pack()
canvas.bind('<Button-1>',mouse_click, '+')
canvas.bind('<Button-2>',mouse_click, '+')
canvas.bind('<Button-3>',mouse_click, '+')
main()
root.mainloop()