Skip to content
Sign upLog in
← Back to Community

Would like to close or not use X11 GFX window with Python Matplotlib

Profile icon
viapotentiaHacker

It used to be that using matplotlib with python on repl.it simply required that you save the plot to a png file rather than display it. With recent updates, repl.it is creating an X11/GFX window in the upper right corner even if no call is made to display graphical output.

How can I suppress the creation of the X11 window or close it?

Voters
Profile icon
viapotentia
Comments
hotnewtop
Profile icon
DenzvenIgnatius

is there a solution for this?

Profile icon
CodeLongAndPros

I think that's a repl.it 'feature'. Try saving the graph to a file.

Profile icon
viapotentia

Saving the image to a file does not prevent the X11 window from activating.

Profile icon
CodeLongAndPros

@viapotentia
Uhhh. Try killall xorg

Ie
while 1==1; do; killall xorg 2> /dev/null; sleep 1;done;

Profile icon
viapotentia

@CodeLongAndPros
, how/where do I execute this command?

The python console doesn't recognize that. It doesn't work in the shell, either.

Profile icon
CodeLongAndPros

@viapotentia
bash? and the while or the killall

Profile icon
viapotentia

@CodeLongAndPros
, thank you, but this does not appear to work. I appreciate your attempts.

Profile icon
CodeLongAndPros

@viapotentia
The only way to suppress it is to edit the HTML or kill X. You could also try using Bash repls.

Profile icon
viapotentia

@CodeLongAndPros
, how could that be implemented to prevent the X11 window from opening in the first place while executing a Python repl (such as https://repl.it/@viapotentia/matplotlibtest)?

Profile icon
CodeLongAndPros

@viapotentia
Depends on who spawned Xorg. If it was runner, the running os.system(“killall xorg”) should work, in theory.

Profile icon
viapotentia

@CodeLongAndPros
, ps -ux shows that the process was started by runner. I can manually kill it by PID, but this seems to crash the who repl.it page, requiring a reload. It also doesn't get rid of the frame, or prevent it from appearing in the first place.

import os
os.system("killall xorg")

... just causes a syntax error message.

The X11 window is being activated as soon as a matplotlib function is called, even though no (screen) output is requested.

Is there some kind of setting in repl.it that is causing the X11 system to go active if matplotlib is called? It used to NOT do this.

Profile icon
CodeLongAndPros

@viapotentia
I think you could try to redirect xorg’s output to dev null.