From f9c9ca794ef19cfcc38d5e4b57b89fde178b61cf Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Thu, 30 Aug 2018 19:15:36 -0700 Subject: [PATCH] Don't try to re-setup any GUI event loop --- src/init.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/init.jl b/src/init.jl index b564d9c3..b595e556 100644 --- a/src/init.jl +++ b/src/init.jl @@ -70,6 +70,14 @@ function find_backend(matplotlib::PyObject) qt2gui = Dict("pyqt5"=>:qt_pyqt5, "pyqt4"=>:qt_pyqt4, "pyside"=>:qt_pyside) + if haskey(matplotlib, :pyplot) + # If matplotlib.pyplot exists, it means that matplotlib + # backend is already configured. It may mean that PyPlot.jl + # is called via PyJulia. + backend = lowercase(matplotlib[:get_backend]()) + return (backend, get(matplotlib2gui, backend, :none)) + end + rcParams = PyDict(matplotlib["rcParams"]) default = lowercase(get(ENV, "MPLBACKEND", getnone(rcParams, "backend", "none")))