Drawing Basics
Position and Size
- The canvas is 400 x 400.
- (x, y) coordinates refer to points on the canvas.
- x values increase as you move right.
- y values increase as you move down.
Rect(left, top, width, height) draws a rectangle.
Colors
Fills
Rect(left, top, width, height, fill='green') draws a green rectangle.
- The
fill argument is optional.
- The default fill color is black.
- To remove the fill, set
fill=None.
Borders
- To draw a border, set the
border property.
Rect(left, top, width, height, border='green') draws a green border.
borderWidth can be used to set the border thickness.
Shapes
Rect for rectangles.
Oval for ovals.
Circle for circles.
Line for lines.
Polygon for custom polygons.
Star for star shapes.
Labels
Label('hello', x, y) draws a label centered at (x, y).
- Font options include 'arial', 'monospace', and more.
- Size, bold, italic, and color can be customized.