Here is my code:
import matplotlib.pyplot
from graph_tool import *
from graph_tool import draw
if __name__ == '__main__':
g = Graph()
v1 = g.add_vertex()
v2 = g.add_vertex()
e = g.add_edge(v1, v2)
draw.graph_draw(g, vertex_text=g.vertex_index, output="two-nodes.pdf")
I am using Python 3.8 and I run this code on Mac Os Catalina 10.15.6. My problem is after the line "from graph_tool import draw" is executed, Python rocket appears in Dock. I think it is very annoying and I don't want to see it. I edited the file:
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/Info.plist
I added "LSUIElement 1" at the end of the file, just before " ". However, this did not resolve the problem. If anyone knows how I can prevent that annoying rocket from appearing, it will be highly appreciated.
With my respects
Instead of
import matplotlib.pyplot as plt
try
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
It's important that the first two lines come before the line import matplotlib.pyplot as plt
. This seems to be an issue with python on OS X, especially with matplotlib. By Default, on OS X, matplotlib uses the macosx
backend which is a interactive Backend(Which causes the rocket ship). This Code changes the default backend to the Agg
backend, which is non-interactive.
You can find more details on https://leancrew.com/all-this/2014/01/stopping-the-python-rocketship-icon/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.