Skip to content

Commit 5736c29

Browse files
authored
Enable interactive mode in GUI MatPlotLib canvas (#280)
1 parent b8b8a88 commit 5736c29

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pyrobosim/pyrobosim/gui/world_canvas.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import time
66
import threading
77
import warnings
8+
import matplotlib.pyplot as plt
89
from matplotlib.figure import Figure
910
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg
1011
from matplotlib.pyplot import Circle
@@ -126,6 +127,7 @@ def __init__(
126127
self.fig = Figure(dpi=dpi, tight_layout=True)
127128
self.axes = self.fig.add_subplot(111)
128129
super(WorldCanvas, self).__init__(self.fig)
130+
plt.ion()
129131

130132
self.main_window = main_window
131133
self.world = world
@@ -417,14 +419,13 @@ def nav_animation_callback(self):
417419
# Check if any robot is currently navigating.
418420
nav_status = [robot.is_moving() for robot in world.robots]
419421
if any(nav_status):
420-
self.update_robots_plot()
421-
422422
# Show the state of the currently selected robot
423423
cur_robot = world.gui.get_current_robot()
424424
if cur_robot is not None and cur_robot.is_moving():
425425
self.show_world_state(cur_robot)
426426
world.gui.set_buttons_during_action(False)
427427

428+
self.update_robots_plot()
428429
self.draw_and_sleep()
429430

430431
def update_robots_plot(self):

0 commit comments

Comments
 (0)