t00.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import goog.graphics as gfx
  2. import goog.dom as dom
  3. def main():
  4. g = gfx.createSimpleGraphics(600, 200)
  5. print g
  6. fill = gfx.SolidFill('yellow')
  7. stroke = gfx.Stroke(2, 'green')
  8. g.drawRect(30, 10, 100, 80, stroke, fill)
  9. stroke = gfx.Stroke(4, 'green')
  10. g.drawImage(30, 110, 276, 110, 'http://www.google.com/intl/en_ALL/images/logo.gif')
  11. g.drawCircle(190, 70, 50, stroke, fill)
  12. stroke = gfx.Stroke(6, 'green')
  13. g.drawEllipse(300, 140, 80, 40, stroke, fill)
  14. # A path
  15. path = gfx.Path()
  16. path.moveTo(320, 30)
  17. path.lineTo(420, 130)
  18. path.lineTo(480, 30)
  19. path.close()
  20. stroke = gfx.Stroke(1, 'green')
  21. g.drawPath(path, stroke, fill)
  22. # Clipped shapes
  23. redFill = gfx.SolidFill('red')
  24. g.drawCircle(540, 10, 50, None, redFill);
  25. g.drawCircle(540, 10, 30, None, fill);
  26. g.drawCircle(560, 210, 30, stroke, fill);
  27. g.drawCircle(560, 210, 45, stroke, None); # no fill
  28. g.drawCircle(600, 90, 30, stroke, fill);
  29. g.render(dom.getElement('canv'))
  30. main()