dudraw.py
The dudraw module defines functions that allow the user to create a simple 2-dimensional drawing. A drawing appears on the canvas. The canvas appears in the window. As a convenience, the module also imports the commonly used Color objects defined in the color module.
Function | annulus |
Draw an annulus centered at (x, y) with outer radius r1, and inner radius r2. |
Function | arc |
Draw an arc portion between angle1 and angle2, of the circumference of a circle centered at (x, y) with a radius r. |
Function | circle |
Draw on the canvas a circle of radius r centered on (x, y). |
Function | clear |
Clear the canvas to color c, where c is an object of class Color. c defaults to dudraw.WHITE. |
Function | clear |
Clear the canvas to color defined by r, g, and b. Defaults to white (255, 255, 255). |
Function | ellipse |
Draw on the canvas an ellipse centered at (x, y) with a width of 2.0 * half_width, and a height of 2.0 * half_height. |
Function | elliptical |
Draw an arc portion between angle1 and angle2, of the circumference of an ellipse centered at (x, y) with a width of half_width, and a height of 2.0 * half_height. |
Function | elliptical |
Draw a sector portion between angle1 and angle2, of the interior of an ellipse centered at (x, y) with a width of half_width, and a height of 2.0 * half_height. |
Function | filled |
Draw a filled annulus centered at (x, y) with outer radius r1, and inner radius r2. |
Function | filled |
Draw on the canvas a filled circle of radius r centered on (x, y). |
Function | filled |
Draw on the canvas a filled ellipse centered at (x, y) with a width of 2.0 * half_width, and a height of 2.0 * half_height. |
Function | filled |
Draw a filled sector portion between angle1 and angle2, of the interior of an ellipse centered at (x, y) with a width of half_width, and a height of 2.0 * half_height. |
Function | filled |
Draw on the canvas a filled polygon with coordinates (x[i], y[i]). |
Function | filled |
Draw a filled quadrilateral on the canvas with corners at (x0, y0), (x1, y1), (x2, y2), and (x3, y3). |
Function | filled |
Draw on the canvas a rectangle of width (2 * halfWidth and height (2 * halfHeight) centered at point (x, y). |
Function | filled |
Draw a filled sector portion between angle1 and angle2, of the interior of a circle centered at (x, y) with a radius r. |
Function | filled |
Draw on the canvas a filled square whose sides are of length 2r, centered on (x, y). |
Function | filled |
Draw a filled triangle on the canvas with corners at (x0, y0), (x1, y1), and (x2, y2). |
Function | get |
Return the height of the current canvas. |
Function | get |
Return the width of the current canvas. |
Function | get |
Return the pen color as an object of class Color. |
Function | get |
Return the color of the pixel at the given user coordinates. |
Function | has |
Return True if the user has pressed a key since the last call, otherwise False. |
Function | keys |
Return the set of keys that are currently being held down by the user. |
Function | keys |
Return the set of keys that the user has released since the last time this function was called. |
Function | keys |
Return the set of keys that the user has typed since the last time this function was called. |
Function | line |
Draw on the canvas a line from (x0, y0) to (x1, y1). |
Function | mouse |
Return True if the left mouse button has been pressed since the last check, and False otherwise. |
Function | mouse |
Return True if the mouse is being click-and-dragged on the canvas, and False otherwise. |
Function | mouse |
Return True if the left mouse button is currently being held down, and False otherwise. |
Function | mouse |
Return True if the left mouse button has been released since the last check, and False otherwise. |
Function | mouse |
Return the x coordinate in user space of the mouse cursor. |
Function | mouse |
Return the y coordinate in user space of the mouse cursor. |
Function | next |
Return a string representing a key that was typed since the last time this function, or the keys_typed() function was called. |
Function | next |
Return a string representing a key that was typed since the last time this function, or the keys_typed() function was called. |
Function | picture |
Draw pic on the canvas centered at (x, y). |
Function | point |
Draw on the canvas a point at coordinates (x, y). |
Function | polygon |
Draw on the canvas a polygon with coordinates (x[i], y[i]). |
Function | polyline |
Draw on the canvas a polyline with coordinates (x[i], y[i]). |
Function | quadrilateral |
Draw a quadrilateral on the canvas with corners at (x0, y0), (x1, y1), (x2, y2), and (x3, y3). |
Function | rectangle |
Draw on the canvas a rectangle of width (2 * halfWidth and height (2 * halfHeight) centered at point (x, y). |
Function | save |
Save the window canvas as a .jpg to filepath specified. |
Function | sector |
Draw a sector portion between angle1 and angle2, of the interior of a circle centered at (x, y) with a radius r. |
Function | set |
Set the size of the canvas to w pixels wide and h pixels high. |
Function | set |
Set the font family to f (e.g. 'Helvetica' or 'Courier'). |
Function | set |
Set the font size to s (e.g. 12, 14, 16..etc). |
Function | set |
Set the pen color to c, where c is an object of class Color. c defaults to dudraw.BLACK. |
Function | set |
Set the pen color using red, green, and blue values. Defaults to black. |
Function | set |
Set the pen width/radius to w |
Function | set |
Set the x-scale and y-scale of the canvas to the same range for both directions. |
Function | set |
Set the x-scale of the canvas such that the minimum y value is min and the maximum y value is max. |
Function | set |
Set the y-scale of the canvas such that the minimum y value is min and the maximum y value is max. |
Function | show |
Copy the canvas to the window canvas, and then wait for msec milliseconds. msec defaults to 0.0. |
Function | square |
Draw on the canvas a square whose sides are of length 2r, centered on (x, y). |
Function | text |
Draw a line of string on the canvas centered at (x, y). |
Function | triangle |
Draw a triangle on the canvas with corners at (x0, y0), (x1, y1), and (x2, y2). |
Function | _ccw |
Undocumented |
Function | _check |
Check if any new event has occured (such as a key typed or button pressed). If a key has been typed, then put that key in a queue. |
Function | _factor |
Undocumented |
Function | _factor |
Undocumented |
Function | _intersect |
Undocumented |
Function | _line |
Undocumented |
Function | _main |
Dispatch to a function that does regression testing, or to a dialog-box-handling function. |
Function | _make |
Undocumented |
Function | _pen |
Undocumented |
Function | _pixel |
Draw on the canvas a pixel at (x, y). |
Function | _pygame |
Convert c, an object of type Color, to an equivalent object of type pygame.Color. Return the result. |
Function | _regression |
Perform regression testing. |
Function | _scale |
Undocumented |
Function | _scale |
Undocumented |
Function | _scale |
Undocumented |
Function | _show |
Copy the canvas to the window canvas. |
Function | _show |
Copy the canvas to the window canvas. Then wait forever, that is, until the user closes the dudraw window. |
Function | _user |
Undocumented |
Function | _user |
Undocumented |
Constant | _BORDER |
Undocumented |
Constant | _DEFAULT |
Undocumented |
Constant | _DEFAULT |
Undocumented |
Constant | _DEFAULT |
Undocumented |
Constant | _DEFAULT |
Undocumented |
Constant | _DEFAULT |
Undocumented |
Constant | _DEFAULT |
Undocumented |
Constant | _DEFAULT |
Undocumented |
Constant | _DEFAULT |
Undocumented |
Variable | _canvas |
Undocumented |
Variable | _canvas |
Undocumented |
Variable | _keys |
Undocumented |
Variable | _keys |
Undocumented |
Variable | _keys |
Undocumented |
Variable | _mouse |
Undocumented |
Variable | _mouse |
Undocumented |
Variable | _mouse |
Undocumented |
Variable | _mouse |
Undocumented |
Variable | _mouse |
Undocumented |
Variable | _pen |
Undocumented |
Variable | _window |
Undocumented |
Variable | _xmax |
Undocumented |
Variable | _xmin |
Undocumented |
Variable | _ymax |
Undocumented |
Variable | _ymin |
Undocumented |
Draw an annulus centered at (x, y) with outer radius r1, and inner radius r2.
An annulus is a ring shape region between two circles centered at the same point but the outer circle r1 has larger radius than the inner circle r2
Parameters | |
x:float | x-coordinate of the center of the two circles |
y:float | x-coordinate of the center of the two circles |
r1:float | radius of of the outer circle (larger radius) |
r2:float | radius of of the inner circle (smaller radius) |
Draw an arc portion between angle1 and angle2, of the circumference of a circle centered at (x, y) with a radius r.
An arc is a contiguous portion of a circle between angle1 and angle2. Note that the line of arc starts at angle1 and goes to angle2 in counter clock-wise direction.
Parameters | |
x:float | x-coordinate of the center of the circle |
y:float | y-coordinate of the center of the circle |
r:float | the radius of the circle |
angle1:float | the starting angle of the arc |
angle2:float | the ending angle of the arc |
Draw on the canvas a circle of radius r centered on (x, y).
Parameters | |
x:float | x-coordinate of the center of the circle |
y:float | y-coordinate of the center of the circle |
r:float | radius of the circle |
Clear the canvas to color c, where c is an object of class Color. c defaults to dudraw.WHITE.
Parameters | |
c:Color | the color to be used to clear the background, defaults to white |
Clear the canvas to color defined by r, g, and b. Defaults to white (255, 255, 255).
Parameters | |
r:float | red color value. 0 for minimum red and 255 for maximum red, defaults to 255 |
g:float | green color value. 0 for minimum red and 255 for maximum green, defaults to 255 |
b:float | blue color value. 0 for minimum red and 255 for maximum blue, defaults to 255 |
Draw on the canvas an ellipse centered at (x, y) with a width of 2.0 * half_width, and a height of 2.0 * half_height.
Parameters | |
x:float | x-coordinate of the center of the ellipse |
y:float | y-coordinate of the center of the ellipse |
halffloat | half the width of the ellipse. Width is the maximum horizontal distance between two points on the surface of the ellipse |
halffloat | half the height of the ellipse. Height is the maximum vertical distance between two points on the surface of the ellipse |
Draw an arc portion between angle1 and angle2, of the circumference of an ellipse centered at (x, y) with a width of half_width, and a height of 2.0 * half_height.
An arc is a contiguous portion of the ellipse between angle1 and angle2. Note that the line of arc starts at angle1 and goes to angle2 in counter clock-wise direction.
Parameters | |
x:float | x-coordinate of the center of the ellipse |
y:float | y-coordinate of the center of the ellipse |
halffloat | half the width of the ellipse. Width is the maximum horizontal distance between two points on the surface of the ellipse |
halffloat | half the height of the ellipse. Height is the maximum vertical distance between two points on the surface of the ellipse |
angle1:float | the starting angle of the arc |
angle2:float | the ending angle of the arc |
Draw a sector portion between angle1 and angle2, of the interior of an ellipse centered at (x, y) with a width of half_width, and a height of 2.0 * half_height.
This is like a slice of an elliptical shaped pizza. Note that the line of the arc of the sector starts at angle1 and goes to angle2 in counter clock-wise direction.
Parameters | |
x:float | x-coordinate of the center of the ellipse |
y:float | y-coordinate of the center of the ellipse |
halffloat | half the width of the ellipse. Width is the maximum horizontal distance between two points on the surface of the ellipse |
halffloat | half the height of the ellipse. Height is the maximum vertical distance between two points on the surface of the ellipse |
angle1:float | the starting angle of the arc |
angle2:float | the ending angle of the arc |
Draw a filled annulus centered at (x, y) with outer radius r1, and inner radius r2.
An annulus is a ring shape region between two circles centered at the same point but the outer circle r1 has larger radius than the inner circle r2
Parameters | |
x:float | x-coordinate of the center of the two circles |
y:float | x-coordinate of the center of the two circles |
r1:float | radius of of the outer circle (larger radius) |
r2:float | radius of of the inner circle (smaller radius) |
Draw on the canvas a filled circle of radius r centered on (x, y).
Parameters | |
x:float | x-coordinate of the center of the circle |
y:float | y-coordinate of the center of the circle |
r:float | radius of the circle |
Draw on the canvas a filled ellipse centered at (x, y) with a width of 2.0 * half_width, and a height of 2.0 * half_height.
Parameters | |
x:float | x-coordinate of the center of the ellipse |
y:float | y-coordinate of the center of the ellipse |
halffloat | half the width of the ellipse. Width is the maximum horizontal distance between two points on the surface of the ellipse |
halffloat | half the height of the ellipse. Height is the maximum vertical distance between two points on the surface of the ellipse |
Draw a filled sector portion between angle1 and angle2, of the interior of an ellipse centered at (x, y) with a width of half_width, and a height of 2.0 * half_height.
This is like a slice of an elliptical shaped pizza. Note that the line of the arc of the sector starts at angle1 and goes to angle2 in counter clock-wise direction.
Parameters | |
x:float | x-coordinate of the center of the ellipse |
y:float | y-coordinate of the center of the ellipse |
halffloat | half the width of the ellipse. Width is the maximum horizontal distance between two points on the surface of the ellipse |
halffloat | half the height of the ellipse. Height is the maximum vertical distance between two points on the surface of the ellipse |
angle1:float | the starting angle of the arc |
angle2:float | the ending angle of the arc |
Draw on the canvas a filled polygon with coordinates (x[i], y[i]).
The lists x and y must contain the same number of values. The two lists correspond to x-coordinates and y-coordinates of points (x[0], y[0]), (x[1], y[1]), (x[2], y[2]),..., (x[-1], y[-1]) on the polygon. Each point on the polygon connects to the point that follows it so (x_0, x_0) connects to (x[1], y[1]) with a straight line, then (x[1], y[1]) connects to (x[2], y[2]) and so on until (x[-1], y[-1]) connects to (x[0], y[0]).
Parameters | |
x:Sequence[ | a list of x-coordinates of the points on the polygon |
y:Sequence[ | a list of y-coordinates of the points on the polygon |
Draw a filled quadrilateral on the canvas with corners at (x0, y0), (x1, y1), (x2, y2), and (x3, y3).
Parameters | |
x0:float | x-coordinate of the first point of the quadrilateral |
y0:float | y-coordinate of the first point of the quadrilateral |
x1:float | x-coordinate of the second point of the quadrilateral |
y1:float | y-coordinate of the second point of the quadrilateral |
x2:float | x-coordinate of the third point of the quadrilateral |
y2:float | y-coordinate of the third point of the quadrilateral |
x3:float | x-coordinate of the fourth point of the quadrilateral |
y3:float | y-coordinate of the fourth point of the quadrilateral |
Draw on the canvas a rectangle of width (2 * halfWidth and height (2 * halfHeight) centered at point (x, y).
Parameters | |
x:float | x-coordinate of the center of the rectangle |
y:float | y-coordinate of the center of the rectangle |
halffloat | half the width of the rectangle |
halffloat | half the height of the rectangle |
Draw a filled sector portion between angle1 and angle2, of the interior of a circle centered at (x, y) with a radius r.
This is like a slice of circle shaped pizza. Note that the line of the arc of the sector starts at angle1 and goes to angle2 in counter clock-wise direction.
Parameters | |
x:float | x-coordinate of the center of the circle |
y:float | y-coordinate of the center of the circle |
r:float | the radius of the circle |
angle1:float | the starting angle of the arc |
angle2:float | the ending angle of the arc |
Draw on the canvas a filled square whose sides are of length 2r, centered on (x, y).
Parameters | |
x:float | x-coordinate of the center of the square |
y:float | y-coordinate of the center of the square |
r:float | half the width of the square |
Draw a filled triangle on the canvas with corners at (x0, y0), (x1, y1), and (x2, y2).
Parameters | |
x0:float | x-coordinate of the first point of the triangle |
y0:float | y-coordinate of the first point of the triangle |
x1:float | x-coordinate of the second point of the triangle |
y1:float | y-coordinate of the second point of the triangle |
x2:float | x-coordinate of the third point of the triangle |
y2:float | y-coordinate of the third point of the triangle |
Return the height of the current canvas.
Returns | |
float | the canvas height in pixels |
Return the width of the current canvas.
Returns | |
float | the canvas width in pixels |
Return the pen color as an object of class Color.
Returns | |
the current value of pen color. This is an object of class Color |
Return the color of the pixel at the given user coordinates.
Parameters | |
x:float | the x-coordinate of the pixel |
y:float | the y-coordinate of the pixel |
Returns | |
Color | the color of the pixel at (x, y) |
Return True if the user has pressed a key since the last call, otherwise False.
Returns | |
bool | a boolen representing whether a key has been pressed |
Return the set of keys that are currently being held down by the user.
Returns | |
set[ | a set of strings representing the keys being held |
Return the set of keys that the user has released since the last time this function was called.
Returns | |
set[ | a set of strings representing the keys released |
Return the set of keys that the user has typed since the last time this function was called.
Returns | |
set[ | a set of strings representing the keys typed |
Draw on the canvas a line from (x0, y0) to (x1, y1).
The placement of the line on the canvas will depend on the values of (x1, y1), (x2, y2) as well as the x-scale and y-scale. Note that if the coordinates are outside the range of min and max x-scale or y-scale then the point won't appear on the canvas
Parameters | |
x0:float | x-coordinate of the first point of the line segment |
y0:float | y-coordinate of the first point of the line segment |
x1:float | x-coordinate of the second point of the line segment |
y1:float | y-coordinate of the second point of the line segment |
Return True if the left mouse button has been pressed since the last check, and False otherwise.
Returns | |
bool | True if the left mouse button has been pressed since last check; False otherwise |
Return True if the mouse is being click-and-dragged on the canvas, and False otherwise.
Returns | |
bool | True if the mouse has moved while held; False otherwise |
Return True if the left mouse button is currently being held down, and False otherwise.
Returns | |
bool | True if the left mouse button is pressed; False otherwise |
Return True if the left mouse button has been released since the last check, and False otherwise.
Returns | |
bool | True if the left mouse button has been released since last check; False otherwise |
Return the x coordinate in user space of the mouse cursor.
Returns | |
float | the x-coordinate of the location of the mouse |
Return the y coordinate in user space of the mouse cursor.
Returns | |
float | the y-coordinate of the location of the mouse |
Return a string representing a key that was typed since the last time this function, or the keys_typed() function was called.
Returns | |
str | a strings representing the key typed |
Return a string representing a key that was typed since the last time this function, or the keys_typed() function was called.
Returns | |
str | a strings representing the key typed |
Draw pic on the canvas centered at (x, y).
The file can be of type .jpg, .png, .gif or .bmp. Filepath is specified as a string, and (x, y) defaults to the midpoint of the canvas.
Parameters | |
filepath:str | a string representing the path of the image file |
x:float | x-coordinate of the center of the image, defaults to x-coordinate of the center of the canvas |
y:float | y-coordinate of the center of the image, defaults to y-coordinate of the center of the canvas |
Draw on the canvas a point at coordinates (x, y).
The placement of the point on the canvas will depend on the values of (x, y) as well as the x-scale and y-scale. Note that if the coordinates are outside the range of min and max x-scale or y-scale then the point won't appear on the canvas
Parameters | |
x:float | the x-coordinate of the point |
y:float | the y-coordinate of the point |
Draw on the canvas a polygon with coordinates (x[i], y[i]).
The lists x and y must contain the same number of values. The two lists correspond to x-coordinates and y-coordinates of points (x[0], y[0]), (x[1], y[1]), (x[2], y[2]),..., (x[-1], y[-1]) on the polygon. Each point on the polygon connects to the point that follows it so (x_0, x_0) connects to (x[1], y[1]) with a straight line, then (x[1], y[1]) connects to (x[2], y[2]) and so on until (x[-1], y[-1]) connects to (x[0], y[0]).
Parameters | |
x:Sequence[ | a list of x-coordinates of the points on the polygon |
y:Sequence[ | a list of y-coordinates of the points on the polygon |
Draw on the canvas a polyline with coordinates (x[i], y[i]).
The lists x and y must contain the same number of values. The two lists correspond to x-coordinates and y-coordinates of points (x[0], y[0]), (x[1], y[1]), (x[2], y[2]),..., (x[-1], y[-1]) on the polyline. Each point on the polyline connects to the point that follows it so (x_0, x_0) connects to (x[1], y[1]) with a straight line, then (x[1], y[1]) connects to (x[2], y[2]) and so on.
Parameters | |
x:Sequence[ | a list of x-coordinates of the points on the polyline |
y:Sequence[ | a list of y-coordinates of the points on the polyline |
Draw a quadrilateral on the canvas with corners at (x0, y0), (x1, y1), (x2, y2), and (x3, y3).
Parameters | |
x0:float | x-coordinate of the first point of the quadrilateral |
y0:float | y-coordinate of the first point of the quadrilateral |
x1:float | x-coordinate of the second point of the quadrilateral |
y1:float | y-coordinate of the second point of the quadrilateral |
x2:float | x-coordinate of the third point of the quadrilateral |
y2:float | y-coordinate of the third point of the quadrilateral |
x3:float | x-coordinate of the fourth point of the quadrilateral |
y3:float | y-coordinate of the fourth point of the quadrilateral |
Draw on the canvas a rectangle of width (2 * halfWidth and height (2 * halfHeight) centered at point (x, y).
Parameters | |
x:float | x-coordinate of the center of the rectangle |
y:float | y-coordinate of the center of the rectangle |
halffloat | half the width of the rectangle |
halffloat | half the height of the rectangle |
Save the window canvas as a .jpg to filepath specified.
Parameters | |
filepath:str | the path of a folder to which the image will be saved |
Draw a sector portion between angle1 and angle2, of the interior of a circle centered at (x, y) with a radius r.
This is like a slice of circle shaped pizza. Note that the line of the arc of the sector starts at angle1 and goes to angle2 in counter clock-wise direction.
Parameters | |
x:float | x-coordinate of the center of the circle |
y:float | y-coordinate of the center of the circle |
r:float | the radius of the circle |
angle1:float | the starting angle of the arc |
angle2:float | the ending angle of the arc |
Set the size of the canvas to w pixels wide and h pixels high.
Calling this function is optional. If you call it, you must do so before calling any drawing function.
Parameters | |
w:float | width of canvas in pixels, defaults to 512 |
h:float | height of canvas in pixels, defaults to 512 |
Raises | |
Exception | error if the dudraw window was already created |
Exception | error if width or height values are non-positive |
Set the font family to f (e.g. 'Helvetica' or 'Courier').
This changes the font used to draw text on the canvas.
Parameters | |
f:str | the new font used for text on canvas, defaults to "Helvetica" if no font is specified |
Set the font size to s (e.g. 12, 14, 16..etc).
the value of the font size is measured in point. A point is equivalent to about 1.33 pixels
Parameters | |
s:int | new font size in point, defaults to 12 if no value is specified |
Set the pen color to c, where c is an object of class Color. c defaults to dudraw.BLACK.
Parameters | |
c:Color | the new pen color, defaults to black if no value is passed |
Set the pen color using red, green, and blue values. Defaults to black.
Parameters | |
r:int | red color value. 0 for minimum red and 255 for maximum red, defaults to 255 |
g:int | green color value. 0 for minimum red and 255 for maximum green, defaults to 255 |
b:int | blue color value. 0 for minimum red and 255 for maximum blue, defaults to 255 |
Set the pen width/radius to w
This affects the subsequent drawing of points and lines. If w is 0.0, then points will be drawn with the minimum possible width and lines with the minimum possible width.
Parameters | |
w:float | new value for the pen radius in pixels. This value must be non-negative, defaults to 0.0 |
Raises | |
Exception | error thrown if the value of w is negative |
Set the x-scale and y-scale of the canvas to the same range for both directions.
The value of max must be greater than the value of min
Parameters | |
min:float | the minimum value of the x-scale and y-scale, defaults to 0.0 if no value is passed |
max:float | the maximum value of the x-scale and y-scale, defaults to 1.0 if no value is passed |
Raises | |
Exception | error if the min value is greater or equal to the max value |
Set the x-scale of the canvas such that the minimum y value is min and the maximum y value is max.
The value of max must be greater than the value of min
Parameters | |
min:float | the minimum value of the x-scale, defaults to 0.0 if no value is passed |
max:float | the maximum value of the x-scale, defaults to 1.0 if no value is passed |
Raises | |
Exception | error if the min value is greater or equal to the max value |
Set the y-scale of the canvas such that the minimum y value is min and the maximum y value is max.
The value of max must be greater than the value of min
Parameters | |
min:float | the minimum value of the y-scale, defaults to 0.0 if no value is passed |
max:float | the maximum value of the y-scale, defaults to 1.0 if no value is passed |
Raises | |
Exception | error if the min value is greater or equal to the max value |
Copy the canvas to the window canvas, and then wait for msec milliseconds. msec defaults to 0.0.
Note that everything we draw is on the canvas so won't show on the screen until we call show
Parameters | |
msec:float | amount of milliseconds to wait after show, defaults to 0.0 |
Draw on the canvas a square whose sides are of length 2r, centered on (x, y).
Parameters | |
x:float | x-coordinate of the center of the square |
y:float | y-coordinate of the center of the square |
r:float | half the width of the square |
Draw a line of string on the canvas centered at (x, y).
The string will appear on a single line. Note that (x, y) is the center of the rectangle that bounds the string. The string uses the current font and font size. Font and font size can be modified using the methods: set_font_family and set_font_size
Parameters | |
x:float | x-coordinate of the center of the text |
y:float | y-coordinate of the center of the text |
s:str | the string that will be draw on the canvas |
Draw a triangle on the canvas with corners at (x0, y0), (x1, y1), and (x2, y2).
Parameters | |
x0:float | x-coordinate of the first point of the triangle |
y0:float | y-coordinate of the first point of the triangle |
x1:float | x-coordinate of the second point of the triangle |
y1:float | y-coordinate of the second point of the triangle |
x2:float | x-coordinate of the third point of the triangle |
y2:float | y-coordinate of the third point of the triangle |
Check if any new event has occured (such as a key typed or button pressed). If a key has been typed, then put that key in a queue.
Dispatch to a function that does regression testing, or to a dialog-box-handling function.
Draw on the canvas a pixel at (x, y).
Parameters | |
x:float | Undocumented |
y:float | Undocumented |
Convert c, an object of type Color, to an equivalent object of type pygame.Color. Return the result.
Parameters | |
c:Color | Undocumented |
Returns | |
pygame.Color | Undocumented |
Undocumented
Parameters | |
p:Sequence[ | Undocumented |
Returns | |
Sequence[ | Undocumented |