I am looking at python and I want to allow the user to click on the centre of the screen and create a circle, this is what I have.

Any help will be very appricated.

import from graphics *

def blueCircle():
    win = GraphWin("Click Here")
    p = win.getMouse()
    circle1 = Circle(Point(p.getX, p.getY) ,50)
    circle1.setFill("Blue")

This might just help you ...

# using the Zelle graphics module (derived from Tkinter)
# http://mcsp.wartburg.edu/zelle/python/graphics.py
# draw a blue circle at mouse click point

from graphics import *

def blueCircle():
    w = 450
    h = 450    
    win = GraphWin("Click in window", w, h)

    p = win.getMouse()
    x = p.getX()
    y = p.getY()
    print(p, x, y)  # test

    circle = Circle(Point(x, y) ,50)
    circle.setFill("Blue")
    circle.draw(win)

    # wait till next mouse click
    p = win.getMouse()
    win.close()

blueCircle()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.