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

« back to all changes in this revision

Viewing changes to enthought/kiva/tests/mac_simpletest.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:
55
55
        gc.close_path();
56
56
 
57
57
class TestCanvas(Canvas):
 
58
 
58
59
    def do_draw(self, gc):
59
60
        w,h = self.GetClientSizeTuple()
 
61
 
 
62
        # Red diagonal line from (0,0) to (w,h)
60
63
        gc.move_to(0,0)
61
64
        gc.line_to(w,h)
62
65
        gc.set_stroke_color((1,0,0))
63
66
        gc.stroke_path()
 
67
        
 
68
        # Green diagonal line from (0,h) to (w,0)
64
69
        gc.move_to(0,h)
65
70
        gc.line_to(w,0)
66
71
        gc.set_stroke_color((0,1,0))
67
72
        gc.stroke_path()
 
73
 
 
74
        # Boundary "line".
68
75
        gc.rect(0,0,w,h)
69
 
        gc.set_stroke_color((0,0,0,.5))
 
76
        gc.set_stroke_color((0,0,0,0.5))
70
77
        gc.set_line_width(20)
71
78
        gc.stroke_path()
72
 
        
73
 
        gc.set_fill_color((0,0,1,0.0))
74
 
        gc.rect(0,0,w,h)
75
 
                
 
79
 
 
80
        # Draw a square, filled with blue (with alpha=0.25)
 
81
        gc.set_stroke_color((0,0,0))
 
82
        gc.set_line_width(2)        
 
83
        gc.set_fill_color((0,0,1,0.25))
 
84
        gc.rect(w/8,h/4,w/3,h/3)
76
85
        gc.draw_path()
77
86
 
 
87
        # Draw the letter 'a'.
78
88
        gc.set_line_width(1)
79
89
        gc.translate_ctm(w/2.0,h/2.0)
80
90
        gc.save_state()