1
|
|
|
|
2
|
|
|
def rotate(angle): |
3
|
|
|
"""Rotates the context. |
4
|
|
|
|
5
|
|
|
Args: |
6
|
|
|
angle (float): The amount by which the context should be rotated. |
7
|
|
|
""" |
8
|
|
|
raise NotImplementedError("rotate() is not implemented") |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
def translate(x, y): |
12
|
|
|
"""Translates the context by x and y. |
13
|
|
|
|
14
|
|
|
Args: |
15
|
|
|
x (float): Horizontal coordinate. |
16
|
|
|
y (float): Vertical coordinate. |
17
|
|
|
""" |
18
|
|
|
raise NotImplementedError("translate() is not implemented") |
19
|
|
|
|
20
|
|
|
|
21
|
|
|
def scale(factor): |
22
|
|
|
"""Scales the context by the provided factor |
23
|
|
|
|
24
|
|
|
Args: |
25
|
|
|
factor (float): The amount by which the current context should be scaled. |
26
|
|
|
""" |
27
|
|
|
raise NotImplementedError("scale() is not implemented") |
28
|
|
|
|
29
|
|
|
|
30
|
|
|
def save(): |
31
|
|
|
"""Saves the current context's translation, rotation and scaling""" |
32
|
|
|
raise NotImplementedError("save() is not implemented") |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
def restore(): |
36
|
|
|
"""Restores the context's translation, rotation and scaling to that of the latest save""" |
37
|
|
|
raise NotImplementedError("restore() is not implemented") |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
def reset_style(): |
41
|
|
|
"""Resets PyPen's current setting surrounding style to their default_values, which includes fill_color, stroke_color, stroke_width""" |
42
|
|
|
raise NotImplementedError("reset_style() is not implemented") |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
def clear_screen(): |
46
|
|
|
"""Clears the screen""" |
47
|
|
|
raise NotImplementedError("clear_screen() not implemented") |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
def clear(): |
51
|
|
|
"""Clears the screen""" |
52
|
|
|
raise NotImplementedError("clear() not implemented") |
53
|
|
|
|
54
|
|
|
|
55
|
|
|
def fill_screen(fill_color): |
56
|
|
|
"""Fills the screen with the specified color |
57
|
|
|
|
58
|
|
|
Args: |
59
|
|
|
fill_color (Color): The color by which to fill the screen. Defaults to the theme's default background color. |
60
|
|
|
""" |
61
|
|
|
raise NotImplementedError("fill_screen() not implemented") |
62
|
|
|
|
63
|
|
|
|
64
|
|
|
def fill(): |
65
|
|
|
"""Fills the current path. Different from fill_screen.""" |
66
|
|
|
raise NotImplementedError("fill() not implemented") |
67
|
|
|
|
68
|
|
|
|
69
|
|
|
def rectangle(x, y, width, height, fill_color, stroke_color, stroke_width): |
70
|
|
|
"""Draws a rectangle on the given coordinate with the given width, height and color |
71
|
|
|
|
72
|
|
|
Args: |
73
|
|
|
x (float): Horizontal coordinate. |
74
|
|
|
y (float): Vertical coordinate. |
75
|
|
|
width (float): Width of the triangle. |
76
|
|
|
height (float): Height of the triangle. |
77
|
|
|
fill_color (Color, optional): The color by which to fill the rectangle. |
78
|
|
|
stroke_color (Color, optional): The color of the rectangle's outline |
79
|
|
|
stroke_width (float, optional): The width of the outline. |
80
|
|
|
""" |
81
|
|
|
raise NotImplementedError("rectangle() not implemented") |
82
|
|
|
|
83
|
|
|
|
84
|
|
|
def circle(x, y, radius, fill_color, stroke_color, stroke_width): |
85
|
|
|
"""Draws a circle on the given coordinate with the given radius and color |
86
|
|
|
|
87
|
|
|
Args: |
88
|
|
|
x (float): Horizontal coordinate. |
89
|
|
|
y (float): Vertical coordinate. |
90
|
|
|
radius (float): Radius of the circle. |
91
|
|
|
fill_color (Color, optional): The color by which to fill the circle. |
92
|
|
|
stroke_color (Color, optional): The color of the circle's outline |
93
|
|
|
stroke_width (float, optional): The width of the outline. |
94
|
|
|
""" |
95
|
|
|
raise NotImplementedError("circle() not implemented") |
96
|
|
|
|
97
|
|
|
|
98
|
|
|
def ellipse(x, y, width, height, fill_color="", stroke_color="", stroke_width=-1): |
99
|
|
|
"""Draws an ellipse on the given coordinate with the given width, height and color |
100
|
|
|
|
101
|
|
|
Args: |
102
|
|
|
x (float): Horizontal coordinate. |
103
|
|
|
y (float): Vertical coordinate. |
104
|
|
|
width (float): Width of the ellipse. |
105
|
|
|
height (float): Height of the ellipse. |
106
|
|
|
fill_color (Color, optional): The color by which to fill the ellipse. |
107
|
|
|
stroke_color (Color, optional): The color of the ellipse's outline |
108
|
|
|
stroke_width (float, optional): The width of the outline. |
109
|
|
|
""" |
110
|
|
|
raise NotImplementedError("ellipse() not implemented") |
111
|
|
|
|
112
|
|
|
|
113
|
|
|
def arc(x, y, radius, start_angle, stop_angle, fill_color="", stroke_color="", stroke_width=-1): |
114
|
|
|
"""Draws an arc on the given coordinate with the given radius, angles and color |
115
|
|
|
|
116
|
|
|
Args: |
117
|
|
|
x (float): Horizontal coordinate. |
118
|
|
|
y (float): Vertical coordinate. |
119
|
|
|
radius (float): Radius of the arc. |
120
|
|
|
start_angle (float): The angle from which to begin drawing the arc. |
121
|
|
|
stop_angle (float): The angle at which to stop drawing the arc. |
122
|
|
|
fill_color (Color, optional): The color by which to fill the arc. |
123
|
|
|
stroke_color (Color, optional): The color of the arc's outline |
124
|
|
|
stroke_width (float, optional): The width of the outline. |
125
|
|
|
""" |
126
|
|
|
raise NotImplementedError("arc() not implemented") |
127
|
|
|
|