@@ -2414,55 +2414,27 @@ def new_timer(self, *args, **kwargs):
24142414 return TimerBase (* args , ** kwargs )
24152415
24162416 def flush_events (self ):
2417- """
2418- Flush the GUI events for the figure. Implemented only for
2419- backends with GUIs.
2420- """
2421- raise NotImplementedError
2417+ """Flush the GUI events for the figure.
24222418
2423- def start_event_loop ( self , timeout ):
2419+ Interactive backends need to reimplement this method.
24242420 """
2425- Start an event loop. This is used to start a blocking event
2426- loop so that interactive functions, such as ginput and
2427- waitforbuttonpress, can wait for events. This should not be
2428- confused with the main GUI event loop, which is always running
2429- and has nothing to do with this.
24302421
2431- This is implemented only for backends with GUIs.
2432- """
2433- raise NotImplementedError
2422+ def start_event_loop (self , timeout = 0 ):
2423+ """Start a blocking event loop.
24342424
2435- def stop_event_loop (self ):
2436- """
2437- Stop an event loop. This is used to stop a blocking event
2438- loop so that interactive functions, such as ginput and
2439- waitforbuttonpress, can wait for events.
2425+ Such an event loop is used by interactive functions, such as `ginput`
2426+ and `waitforbuttonpress`, to wait for events.
24402427
2441- This is implemented only for backends with GUIs.
2442- """
2443- raise NotImplementedError
2428+ The event loop blocks until a callback function triggers
2429+ `stop_event_loop`, or *timeout* is reached.
24442430
2445- def start_event_loop_default (self , timeout = 0 ):
2446- """
2447- Start an event loop. This is used to start a blocking event
2448- loop so that interactive functions, such as ginput and
2449- waitforbuttonpress, can wait for events. This should not be
2450- confused with the main GUI event loop, which is always running
2451- and has nothing to do with this.
2431+ If *timeout* is negative, never timeout.
24522432
2453- This function provides default event loop functionality based
2454- on time.sleep that is meant to be used until event loop
2455- functions for each of the GUI backends can be written. As
2456- such, it throws a deprecated warning.
2433+ Only interactive backends need to reimplement this method and it relies
2434+ on `flush_events` being properly implemented.
24572435
2458- This call blocks until a callback function triggers
2459- stop_event_loop() or *timeout* is reached. If *timeout* is
2460- <=0, never timeout.
2436+ Interactive backends should implement this in a more native way.
24612437 """
2462- str = "Using default event loop until function specific"
2463- str += " to this GUI is implemented"
2464- warnings .warn (str , mplDeprecation )
2465-
24662438 if timeout <= 0 :
24672439 timeout = np .inf
24682440 timestep = 0.01
@@ -2473,15 +2445,19 @@ def start_event_loop_default(self, timeout=0):
24732445 time .sleep (timestep )
24742446 counter += 1
24752447
2476- def stop_event_loop_default (self ):
2477- """
2478- Stop an event loop. This is used to stop a blocking event
2479- loop so that interactive functions, such as ginput and
2480- waitforbuttonpress, can wait for events.
2448+ def stop_event_loop (self ):
2449+ """Stop the current blocking event loop.
24812450
2451+ Interactive backends need to reimplement this to match
2452+ `start_event_loop`
24822453 """
24832454 self ._looping = False
24842455
2456+ start_event_loop_default = cbook .deprecated (
2457+ "2.1" , name = "start_event_loop_default" )(start_event_loop )
2458+ stop_event_loop_default = cbook .deprecated (
2459+ "2.1" , name = "stop_event_loop_default" )(stop_event_loop )
2460+
24852461
24862462def key_press_handler (event , canvas , toolbar = None ):
24872463 """
0 commit comments