~ubuntu-branches/ubuntu/trusty/python-enable/trusty

« back to all changes in this revision

Viewing changes to examples/kiva/star.py

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2010-10-17 23:10:41 UTC
  • mto: (1.2.1 upstream) (8.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20101017231041-rziowhgl7zhxra2i
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from __future__ import with_statement
 
2
 
1
3
from scipy import pi
2
4
from enthought.kiva.backend_image import GraphicsContext
3
5
   
14
16
 
15
17
gc = GraphicsContext((500,500))
16
18
 
17
 
gc.save_state()
18
 
gc.set_alpha(0.3)
19
 
gc.set_stroke_color((1.0,0.0,0.0))
20
 
gc.set_fill_color((0.0,1.0,0.0))
 
19
with gc:
 
20
    gc.set_alpha(0.3)
 
21
    gc.set_stroke_color((1.0,0.0,0.0))
 
22
    gc.set_fill_color((0.0,1.0,0.0))
21
23
 
22
 
for i in range(0,600,5):
23
 
    gc.save_state()
24
 
    gc.translate_ctm(i,i)
25
 
    gc.rotate_ctm(i*pi/180.)
26
 
    add_star(gc)
27
 
    gc.draw_path()
28
 
    gc.restore_state()
29
 
gc.restore_state()
 
24
    for i in range(0,600,5):
 
25
        with gc:
 
26
            gc.translate_ctm(i,i)
 
27
            gc.rotate_ctm(i*pi/180.)
 
28
            add_star(gc)
 
29
            gc.draw_path()
30
30
 
31
31
gc.set_fill_color((0.5,0.5,0.5,0.4))
32
32
gc.rect(150,150,200,200)