From a498e5c77a1f117e8217242d44967aa256a17582 Mon Sep 17 00:00:00 2001 From: Ted Ralphs Date: Thu, 2 Apr 2020 18:24:40 -0400 Subject: [PATCH] Clicking anywhere in display window advances to the next iteration by default --- setup.py | 2 +- src/grumpy/polyhedron2D.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 1e55a03..3bd5c42 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ import setuptools setup(name='coinor.grumpy', - version='0.9.2', + version='0.9.3', description='Graphics for Understanding Mathematical Programming (GrUMPy)', long_description='''GrUMPy is a class for visualizing various algorithm used in solving discrete optimization problem. It has a class for dynamically generating and visualizing branch-and-bound trees that is derived from the GiMPy graph class. Using the branch-and-bound class, a user can visualize the branch-and-bound process in a number of different ways either by building the tree dynamically through direct calls to Python from the solver or by piping the output of an instrumented solver to GrUMPy for parsing. The branch-and-bound class also includes a pure Python implementation of branch and bound that is targeted at educational use. diff --git a/src/grumpy/polyhedron2D.py b/src/grumpy/polyhedron2D.py index c707023..5f0b9fc 100755 --- a/src/grumpy/polyhedron2D.py +++ b/src/grumpy/polyhedron2D.py @@ -316,9 +316,15 @@ def set_xlim(self, xlim): def set_ylim(self, ylim): self.ax.set_ylim(ylim) - def show(self): + def show(self, pause = True, wait_for_click = True): plt.legend() - plt.show() + if wait_for_click == True: + plt.draw() + if plt.waitforbuttonpress(timeout = 10000): + plt.close() + exit() + else: + plt.show(block=pause) self.fig = None if __name__ == '__main__':