mercredi 22 avril 2015

Fill Color Python Graphic (India Flag)

I'm working now on creating the Indian flag in the Graphwin graphics system in python. I'm just missing something with my code right now. When I run this code below, the dark green covers up the white. But when I remove the setFill('darkgreen') from the bottom, the white shows up just fine, and doesn't cover anything else out. What am I missing?

from graphics import *

def main():
  win = GraphWin("India Flag", 500, 500)

  pt = Point(50,50)
  pt.draw(win)

  top = Rectangle(Point(260,100), pt)
  top.setFill('orange')
  top.draw(win)

  pt2 = Point(50, 150)
  middle = Rectangle(Point(260,100), pt2)
  middle.setFill('white')
  middle.draw(win)

  pt3 = Point(50, 200)
  bottom = Rectangle(Point(260,100), pt3)
  bottom.setFill('darkgreen')
  bottom.draw(win)

main ()

any help is appreciated!

Aucun commentaire:

Enregistrer un commentaire