Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf6e282b

Browse files
committed
FIX: Event loop timers should only run for the specified time
The implementation of start_event_loop would previously just countthe number of sleeps that occurred. But this could lead to longerevent loop times if flush_events() added time into the loop. Wewant the condition to be dependent on the end-time so we don'trun our loop longer than necessary.
1 parent0f6a157 commitf6e282b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

‎lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,12 +2321,10 @@ def start_event_loop(self, timeout=0):
23212321
iftimeout<=0:
23222322
timeout=np.inf
23232323
timestep=0.01
2324-
counter=0
2325-
self._looping=True
2326-
whileself._loopingandcounter*timestep<timeout:
2324+
t_end=time.time()+timeout
2325+
whiletime.time()<t_end:
23272326
self.flush_events()
23282327
time.sleep(timestep)
2329-
counter+=1
23302328

23312329
defstop_event_loop(self):
23322330
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp