Z101 Z101 - 9 months ago 54
Python Question

Circles in Python - Looking for source that explains the method

I am currently teaching myself Python by working through a Pac Man program.

In this program, a Pac Man is drawn by using the

circle method:

screen point = (300, 240)
self.gridSize = 30
fillColor = yellow ## This is actually reflected in RGB values
outlineColor = yellow ##This is actually reflected in RGB values
endpoints = (0,0)
width = 2

circle(screen_point, PACMAN_SCALE * self.gridSize, fillColor = fillColor, outlineColor = outlineColor, endpoints = endpoints, width = width)

I understand the first 4 arguments of the circle method, but what are the last two:

I also had difficulties finding some documentation on the circle method (all I can find is about the oval method).

Any help would be highly appreciated.

Answer Source

tkinter doesn't have a circle method. It does have a canvas object which has a draw_oval method. Most likely, this circle method you have is a wrapper around that.

The width attribute in your example likely has to do with the width of the outline. However, the draw_oval method has no argument for endpoints, so they are likely unique to the circle method you are calling. You'll have to consult the documentation or implementation of that method to know what it is for.