File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,10 +46,10 @@ def _create_qApp():
4646 qApp = qt .QApplication ( [" " ] )
4747 qt .QObject .connect ( qApp , qt .SIGNAL ( "lastWindowClosed()" ),
4848 qApp , qt .SLOT ( "quit()" ) )
49- else :
50- # someone else aready created the qApp and
51- # we let them handle the event-loop control.
52- show . _needmain = False
49+ #remember that matplotlib created the qApp - will be used by show()
50+ _create_qApp . qAppCreatedHere = True
51+
52+ _create_qApp . qAppCreatedHere = False
5353
5454def show ():
5555 """
@@ -65,11 +65,8 @@ def show():
6565 if figManager != None :
6666 figManager .canvas .draw ()
6767
68- if ( show ._needmain ):
69- qt .qApp .exec_loop ()
70- show ._needmain = False
71-
72- show ._needmain = True
68+ if _create_qApp .qAppCreatedHere :
69+ qt .qApp .exec_loop ()
7370
7471
7572def new_figure_manager ( num , * args , ** kwargs ):
Original file line number Diff line number Diff line change @@ -47,9 +47,9 @@ def _create_qApp():
4747 QtCore .QObject .connect ( qApp , QtCore .SIGNAL ( "lastWindowClosed()" ),
4848 qApp , QtCore .SLOT ( "quit()" ) )
4949 else :
50- # someone else aready created the qApp and
51- # we let them handle the event-loop control.
52- show . _needmain = False
50+ _create_qApp . qAppCreatedHere = True
51+
52+ _create_qApp . qAppCreatedHere = False
5353
5454def show ():
5555 """
@@ -65,11 +65,8 @@ def show():
6565 if figManager != None :
6666 figManager .canvas .draw ()
6767
68- if ( show ._needmain ):
69- qApp .exec_ ()
70- show ._needmain = False
71-
72- show ._needmain = True
68+ if _create_qApp .qAppCreatedHere :
69+ QtGui .qApp .exec_ ()
7370
7471
7572def new_figure_manager ( num , * args , ** kwargs ):
You can’t perform that action at this time.
0 commit comments