@@ -200,6 +200,7 @@ def __init__(self, figure):
200200 self .connect ('motion_notify_event' , self .motion_notify_event )
201201 self .connect ('leave_notify_event' , self .leave_notify_event )
202202 self .connect ('enter_notify_event' , self .enter_notify_event )
203+ self .connect ('size_allocate' , self .size_allocate )
203204
204205 self .set_events (self .__class__ .event_mask )
205206
@@ -275,6 +276,17 @@ def leave_notify_event(self, widget, event):
275276 def enter_notify_event (self , widget , event ):
276277 FigureCanvasBase .enter_notify_event (self , event )
277278
279+ def size_allocate (self , widget , allocation ):
280+ if _debug :
281+ print ("FigureCanvasGTK3.%s" % fn_name ())
282+ print ("size_allocate (%d x %d)" % (allocation .width , allocation .height ))
283+ dpival = self .figure .dpi
284+ winch = allocation .width / dpival
285+ hinch = allocation .height / dpival
286+ self .figure .set_size_inches (winch , hinch )
287+ FigureCanvasBase .resize_event (self )
288+ self .draw_idle ()
289+
278290 def _get_key (self , event ):
279291 if event .keyval in self .keyvald :
280292 key = self .keyvald [event .keyval ]
0 commit comments