def mouse_click(x, y): global object if object == 'Ball': balls.add(Ball(x, y, random_angle())) elif object == "Floater": balls.add(Floater(x, y, random_angle())) elif object == "Black_Hole": simu.add(Black_Hole(x, y)) elif object == "Pulsator": simu.add(Pulsator(x, y)) elif object == "Remove": g = balls h = set() k = set() for f in g: if f.contains((x, y)): h.add(f) for s in simu: if s.contains((x, y)): k.add(s) for l in h: remove(l) for b in k: simu.remove(b) pass elif object == "Hunter": simu.add(Hunter(x, y, random_angle()))
def mouse_click(x, y): if button == 'Ball': simulation.add(Ball(x, y)) elif button == 'Floater': simulation.add(Floater(x, y)) elif button == 'Black_Hole': simulation.add(Black_Hole(x, y)) elif button == 'Pulsator': simulation.add(Pulsator(x, y)) elif button == 'Hunter': simulation.add(Hunter(x, y)) elif button == 'Special': simulation.add(Special(x, y)) elif button == 'Remove': for i in simulation.copy(): if i.distance((x, y)) < i.radius: remove(i)
def mouse_click(x,y): global selection, simultons if selection == 'Remove': #Need to finish for sim in simultons.copy(): if sim.contains( (x,y) ): remove(sim) elif selection == 'Ball': add( Ball(x,y,5,5,0,5) ) elif selection == 'Floater': add( Floater(x,y,5,5,0,5) ) elif selection == 'Black_Hole': add( Black_Hole(x,y,20,20) ) elif selection == 'Pulsator': add( Pulsator(x,y,20,20) ) elif selection == 'Hunter': add( Hunter(x,y,20,20,0,5) ) elif selection == 'Special': add( Special(x,y,5,5,0,10) )
def mouse_click(x,y): try: if object_name == 'Ball': balls.add(Ball(x,y)) elif object_name == 'Floater': balls.add(Floater(x,y)) elif object_name == 'Black_Hole': balls.add(Black_Hole(x,y)) elif object_name == 'Pulsator': balls.add(Pulsator(x,y)) elif object_name == 'Hunter': balls.add(Hunter(x,y)) elif object_name == 'Special': balls.add(Special(x,y)) elif object_name == 'Remove': for i in find(lambda a: a.contains((x,y))): balls.remove(i) except: pass
def mouse_click(x, y): global balls if select_kind == 'Remove': for b in balls: coor = b.get_location() if coor[0] - 5 < x and x < coor[0] + 5 and coor[ 1] - 5 < y and y < coor[1] + 5: remove(b) break elif select_kind == 'Ball': add(Ball(x, y)) elif select_kind == 'Floater': add(Floater(x, y)) elif select_kind == 'Black_Hole': add(Black_Hole(x, y)) elif select_kind == 'Pulsator': add(Pulsator(x, y)) elif select_kind == 'Hunter': add(Hunter(x, y)) elif select_kind == 'Special': add(Special(x, y))
def mouse_click(x,y): global balls, click, remove_set if str(click) == "Remove": try: for ele in balls: if ele.contains((x,y)): remove(ele) except: pass else: if str(click) == "Ball": add(Ball(x,y)) elif str(click) == 'Black_Hole': add(Black_Hole(x,y)) elif str(click) == 'Floater': add(Floater(x,y)) elif str(click) == 'Hunter': add(Hunter(x,y)) elif str(click) == 'Pulsator': add(Pulsator(x,y)) elif str(click) == "Special": add(Special(x,y))