@@ -452,7 +452,11 @@ def __init__(self, canvas, window):
452452 self .win = window
453453 GObject .GObject .__init__ (self )
454454 NavigationToolbar2 .__init__ (self , canvas )
455- self .ctx = None
455+
456+ @cbook .deprecated ("3.3" )
457+ @property
458+ def ctx (self ):
459+ return self .canvas .get_property ("window" ).cairo_create ()
456460
457461 def set_message (self , s ):
458462 self .message .set_label (s )
@@ -464,7 +468,7 @@ def set_cursor(self, cursor):
464468 def draw_rubberband (self , event , x0 , y0 , x1 , y1 ):
465469 # adapted from
466470 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/189744
467- self . ctx = self .canvas .get_property ("window" ).cairo_create ()
471+ ctx = self .canvas .get_property ("window" ).cairo_create ()
468472
469473 # todo: instead of redrawing the entire figure, copy the part of
470474 # the figure that was covered by the previous rubberband rectangle
@@ -477,11 +481,11 @@ def draw_rubberband(self, event, x0, y0, x1, y1):
477481 h = abs (y1 - y0 )
478482 rect = [int (val ) for val in (min (x0 , x1 ), min (y0 , y1 ), w , h )]
479483
480- self . ctx .new_path ()
481- self . ctx .set_line_width (0.5 )
482- self . ctx .rectangle (rect [ 0 ], rect [ 1 ], rect [ 2 ], rect [ 3 ] )
483- self . ctx .set_source_rgb (0 , 0 , 0 )
484- self . ctx .stroke ()
484+ ctx .new_path ()
485+ ctx .set_line_width (0.5 )
486+ ctx .rectangle (* rect )
487+ ctx .set_source_rgb (0 , 0 , 0 )
488+ ctx .stroke ()
485489
486490 def _init_toolbar (self ):
487491 self .set_style (Gtk .ToolbarStyle .ICONS )
0 commit comments