Reference for draw_rect
Draw a rectangle. This is part of the reference section.
Arc
Buffer
Data
Dialog
Ellipse
Geo Utils
Image
Joystick (future)
Keyboard
Line
Mouse / Touchscreen
Pixel
Rectangle
draw_rect
Renderers
Shape
Sound (future)
Style
System
Text
Transform
Purpose
Draw a rectangle or, if width and height are the same, a square.
Snippet
Draw a rectangle at x coordinate of 100 and y coordinate of 150 using a width of 20 pixels and height of 40 pixels. Note that a width and height of zero in corner mode is the same as draw_pixel.
sketch.set_rect_mode('center') sketch.draw_rect(100, 150, 20, 40)
Parameters
- x1: The x location at which to draw the rectangle.
- y1: The y location at which to draw the rectangle.
- x2: Horizontal size. Note that a width of zero in corner mode sets a single pixel row.
- y2: Vertical size. Note that a widtdh of zero in corner mode sets a single pixel column.
Examples
Availability
Available for all platforms.