z_flag_maldives.py

z_flag_maldives.py   Another flag, this one with a crescent moon shape so I could try the create_arc method.  Also shows the create_oval method, which is used for drawing both circles and arcs.  And explains how to get more accurate color matching.

Compare to https://www.cia.gov/library/publications/the-world-factbook/flags/flagtemplate_mv.html ... the default red and green colors are a poor match, and the crescent using arc is terrible.  I couldn’t get arc to work as I had hoped. Comment out line 44 and uncomment the block of lines from 47-54 to see how I started this using overlapping circles with .create_oval.  The crescent still isn’t exact but is much better than I got with the arc.  Feel free to modify this and post code for a more exact solution if you get it.  It will look funny at first because of  the overlapping circle’s color.

Notice you define two points, like a box or rectangle, to define an oval.  If the box is square then you draw a circle, otherwise it’s an oval. I used the Color Picker in Photoshop to grab more accurate RGB values for the flag’s colors off of a screen capture.  I assigned these colors to variables in lines 32 and 33.  Switch these in for the defaults at lines 26 and 27 and compare to the original.  Should be a good match. OK, the main things here are the intro to .create_arc (even if it didn’t suit this problem), intro to .create_oval for circles and ovals, and how you can get an accurate color match if you sample the colors in an image editor.