📕

# Ch. 2 - Appendix

## Appendix

### Other Drawing methods:

#### Ellipse

Draws an ellipse (oval) on the screen. It is as if it draws the rectangle and then makes the curved Ellipse shape inside of it.

Form: `pygame.draw.ellipse(screen, colour, vertices, width)`

Variables:
Screen - the created screen where we are drawing the ellipse Color - RGB colour, can be predefined like RED in the example or defined in the statement as (red, green, blue) e.g. (100, 200, 155) Vertices - (x1, y1, w, h) where x1, y1 are the coordinates of the top left and w, h are the width and height of the rectangle in which the ellipse would fit within. Width - optional, does not have to be there, will fill in the ellipse if it is not. If it is, then width represents the thickness of the outside of the ellipse.

Examples:
`pygame.draw.ellipse(screen, (255, 0, 0), (120,330, 200, 500))` `pygame.draw.ellipse(screen, RED, (0,0, 200,500), 2)`

#### Line

Draws a line on the screen

Form: `pygame.draw.line(screen, colour, startCoordinates, endCoordinates, width)`

Variables:
Screen - the created screen where we are drawing the line
Colour - RGB colour, can be predefined like RED in the example or defined in the statement as (red, green, blue) e.g. (100, 200, 155)
StartCoordinates - (x1, y1), where x1, y1 are the coordinates of the beginning of the line
EndCoordinates - (x2, y2), where x2, y2 are the coordinates of the end of the line
Width - optional, does not have to be there. If it is, then width represents the thickness of the line.

Example:
`pygame.draw.line(screen, RED, (100, 200), (50, 350), 10)`

#### Circle

Draws a circle on the screen

Form: `pygame.draw.circle(screen, colour, pos, radius, width)`

Variables:
Screen - the created screen where we are drawing the circle Colour - RGB colour, can be predefined like RED in the example or defined in the statement as (red, green, blue) e.g. (100, 200, 155) Pos- (x1, y1) where x1, y1 are the coordinates of the center of the circle Radius - the radius of the circle Width - optional, does not have to be there, will fill in the circle if it is not. If it is, then width represents the thickness of the outside of the circle

Examples:
`pygame.draw.circle(screen, RED, (0, 0), 100)` `pygame.draw.circle(screen, RED, (0,0),100, 30)`

#### Arc

Draws an arc on the screen

Form: `pygame.draw.arc(screen, colour, vertices, startAngle, endAngle, width)`

Variables:
Screen - the created screen where we are drawing the arc Colour - RGB colour, can be predefined like RED in the example or defined in the statement as (red, green, blue) e.g. (100, 200, 155) Vertices - (x1, y1, w, h) where x1, y1 are the coordinates of the top left and w,h are the height and width of the rectangle in which the arc would fit within. StartAngle - the angle (in radians) at which the arc would start (on the right is 0) EndAngle - the angle (in radians) at which the arc ends Width - optional, thickness to draw the outer edge

Examples:
`pygame.draw.arc(screen,(100, 200, 155), (50, 50, 200, 200), 0, math.pi)` `pygame.draw.arc(screen,RED, (0, 0, 300, 250), math.pi / 2 , 3*math.pi/2)` `pygame.draw.arc(screen, BLUE, (100, 100, 200, 200), math.radians(30), math.radians(150))`

Note:
• To use `math.pi`, add import math at the top of your program
• Use `math.radians` to convert from degrees to radians.

7️⃣
2.7 - Conclusion

3️⃣
Ch.3 - Events

⚖️
{"ft_lang_label":"__label__en","ft_lang_prob":0.80086154,"math_prob":0.97893995,"size":3593,"snap":"2023-40-2023-50","text_gpt3_token_len":974,"char_repetition_ratio":0.14600167,"word_repetition_ratio":0.37855947,"special_character_ratio":0.2964097,"punctuation_ratio":0.22666667,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9934366,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-12-03T04:55:21Z\",\"WARC-Record-ID\":\"<urn:uuid:66c42494-6b56-481c-a350-e7f0b5defd7d>\",\"Content-Length\":\"100586\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:2d0b3491-72bb-4d4f-a384-0d7321df0f7d>\",\"WARC-Concurrent-To\":\"<urn:uuid:f3cf4426-ed69-49d1-9094-6f16e65721a9>\",\"WARC-IP-Address\":\"76.76.21.9\",\"WARC-Target-URI\":\"https://www.code4tomorrow.org/courses/python/games/ch.2-pygame-basics/ch.-2-appendix\",\"WARC-Payload-Digest\":\"sha1:XXEKTF7W3MDSLFIEVDV6ERJQIEONGM66\",\"WARC-Block-Digest\":\"sha1:YX6P3OVQKYVBUCTMYCGJ7CV4M7BKMI3Q\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-50/CC-MAIN-2023-50_segments_1700679100484.76_warc_CC-MAIN-20231203030948-20231203060948-00298.warc.gz\"}"}