Difference between revisions of "Python:Flags with Rectangles Tutorial"

From Progzoo
Jump to: navigation, search
(Libya)
(Germany)
Line 44: Line 44:
 
[[Image:flaggermany.png|border]] <prog>
 
[[Image:flaggermany.png|border]] <prog>
 
g = canvas.canvas()
 
g = canvas.canvas()
g.fill(path.rect(0,0,3,0.3),[color.rgb.black])
+
g.fill(path.rect(0,0,150,30),[color.rgb.black])
 
</prog>
 
</prog>
 
<answer>
 
<answer>
 
g = canvas.canvas()
 
g = canvas.canvas()
g.fill(path.rect(0,0 ,3,0.6),[color.rgb(1,1,0)])
+
g.fill(path.rect(0, 0,150,30),[color.rgb(1,1,0)])
g.fill(path.rect(0,0.6,3,1.2),[color.rgb.red])
+
g.fill(path.rect(0,30,150,30),[color.rgb.red])
g.fill(path.rect(0,1.2,3,0.6),[color.rgb.black])
+
g.fill(path.rect(0,60,150,30),[color.rgb.black])
 
</answer></question>
 
</answer></question>
  

Revision as of 18:56, 2 September 2008

Libya

The flag of Libya is a simple green rectangle.

Try the program as it is given, then change it so that the green rectangle is 3 wide.
Flaglibya.png

[Font] [Default] [Show] [Resize] [History] [Profile]

France

The flag of France is blue, white and red. The code given draws only one of the three rectangles required, and it is in the wrong place.
Flag guide france.png

[Font] [Default] [Show] [Resize] [History] [Profile]

Germany

The flag of Germany is black, red and yellow.

Note that:

  • 0,0 is in the bottom left corner
  • yellow is color.rgb(1,1,0)

Flaggermany.png

[Font] [Default] [Show] [Resize] [History] [Profile]

Japan

  • The flag of Japan is a red circle on a white background.
  • The rectangle is 150 by 100.
  • The circle is in position 45,20, width and height are 60,60.
  • The dark lines are NOT part of the flag. They are shown as guides only.

Flagjapan.png


[Font] [Default] [Show] [Resize] [History] [Profile]