From d1e012ea30798fe0fa636a18aca7deb9e0525420 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Tue, 4 Sep 2012 22:07:59 -0400 Subject: [PATCH] BUG: Initialize QApplication when creating Plugin. QWidgets cannot be initialized unless QApplication has been created. In cases where the Plugin is created before the ImageViewer, ensure that QApplication exists. --- skimage/viewer/plugins/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/skimage/viewer/plugins/base.py b/skimage/viewer/plugins/base.py index ae240c20..074e18d4 100644 --- a/skimage/viewer/plugins/base.py +++ b/skimage/viewer/plugins/base.py @@ -14,7 +14,7 @@ try: except ImportError: print("Could not import matplotlib -- skimage.viewer not available.") -from ..utils import RequiredAttr +from ..utils import RequiredAttr, init_qtapp class Plugin(QDialog): @@ -82,6 +82,7 @@ class Plugin(QDialog): draws_on_image = False def __init__(self, image_filter=None, height=0, width=400, useblit=None): + init_qtapp() super(Plugin, self).__init__() self.image_viewer = None