@@ -200,6 +200,7 @@ def __init__(self, figure):
200
200
self .connect ('motion_notify_event' , self .motion_notify_event )
201
201
self .connect ('leave_notify_event' , self .leave_notify_event )
202
202
self .connect ('enter_notify_event' , self .enter_notify_event )
203
+ self .connect ('size_allocate' , self .size_allocate )
203
204
204
205
self .set_events (self .__class__ .event_mask )
205
206
@@ -275,6 +276,17 @@ def leave_notify_event(self, widget, event):
275
276
def enter_notify_event (self , widget , event ):
276
277
FigureCanvasBase .enter_notify_event (self , event )
277
278
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
+
278
290
def _get_key (self , event ):
279
291
if event .keyval in self .keyvald :
280
292
key = self .keyvald [event .keyval ]
0 commit comments