Ask coding questions

← Back to all posts
Would like to close or not use X11 GFX window with Python Matplotlib
h
viapotentia (0)

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?

Comments
hotnewtop
DenzvenIgnatius (0)

is there a solution for this?

CodeLongAndPros (1622)

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

viapotentia (0)

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

CodeLongAndPros (1622)

@viapotentia Uhhh. Try killall xorg

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

viapotentia (0)

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

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

CodeLongAndPros (1622)

@viapotentia bash? and the while or the killall

viapotentia (0)

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

CodeLongAndPros (1622)

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

viapotentia (0)

@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)?

CodeLongAndPros (1622)

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

viapotentia (0)

@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.

CodeLongAndPros (1622)

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