Skip to content

create_circle()

Luke edited this page Apr 12, 2020 · 3 revisions

CanvasPlus.create_circle()

create_oval kinda sucks (ngl); it is much more intuitive to use this method.

from numbers import Real
def create_circle(self, x: Real, y: Real, radius: Real, **kwargs) -> int

Creates a circle with the centre x, y, and a radius, rather than create_oval(x1, y1, x2, y2, **kwargs), which can be unintuitive to use in many situations.

Example:

from tkinter import Tk
from CanvasPlus import CanvasPlus

root = Tk()
canvas = CanvasPlus(root, width=800, height=800, background = "white")
canvas.pack()

canvas.create_circle(300, 300, 100, fill = "black", outline = "green", width = 3)
canvas.create_circle(300, 100, 75, fill = "#373737", outline = "red")
canvas.create_circle(500, 500, 5, fill = "blue", outline = "grey50", width = 1)

canvas.update()
canvas.mainloop()

Screen Shot 2020-03-30 at 2 12 29 PM

Clone this wiki locally