<s> """<STR_LIT>""" <EOL> def get_app_wx ( * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> import wx <EOL> app = wx . GetApp ( ) <EOL> if app is None : <EOL> if '<STR_LIT>' not in kwargs : <EOL> kwargs [ '<STR_LIT>' ] = False <EOL> app = wx . PySimpleApp ( * args , ** kwargs ) <EOL> return app <EOL> def is_event_loop_running_wx ( app = None ) : <EOL> """<STR_LIT>""" <EOL> if app is None : <EOL> app = get_app_wx ( ) <EOL> if hasattr ( app , '<STR_LIT>' ) : <EOL> return app . _in_event_loop <EOL> else : <EOL> return app . IsMainLoopRunning ( ) <EOL> def start_event_loop_wx ( app = None ) : <EOL> """<STR_LIT>""" <EOL> if app is None : <EOL> app = get_app_wx ( ) <EOL> if not is_event_loop_running_wx ( app ) : <EOL> app . _in_event_loop = True <EOL> app . MainLoop ( ) <EOL> app . _in_event_loop = False <EOL> else : <EOL> app . _in_event_loop = True <EOL> def get_app_qt4 ( * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> from IPython . external . qt_for_kernel import QtGui <EOL> app = QtGui . QApplication . instance ( ) <EOL> if app is None : <EOL> if not args : <EOL> args = ( [ '<STR_LIT>' ] , ) <EOL> app = QtGui . QApplication ( * args , ** kwargs ) <EOL> return app <EOL> def is_event_loop_running_qt4 ( app = None ) : <EOL> """<STR_LIT>""" <EOL> if app is None : <EOL> app = get_app_qt4 ( [ '<STR_LIT>' ] ) <EOL> if hasattr ( app , '<STR_LIT>' ) : <EOL> return app . _in_event_loop <EOL> else : <EOL> return False <EOL> def start_event_loop_qt4 ( app = None ) : <EOL> """<STR_LIT>""" <EOL> if app is None : <EOL> app = get_app_qt4 ( [ '<STR_LIT>' ] ) <EOL> if not is_event_loop_running_qt4 ( app ) : <EOL> app . _in_event_loop = True <EOL> app . exec_ ( ) <EOL> app . _in_event_loop = False <EOL> else : <EOL> app . _in_event_loop = True </s>
