I want to run python script that only generates image from tkinter canvas. The error I am having is
_tkinter.TclError: couldn't connect to display ":0"
I have find some simmilar problems here so my attempt is:
running test.py
import tkinter
import random
canvas = tkinter.Canvas() # <-- error occurs here
canvas.pack()
x = random.randrange(380)
y = random.randrange(260)
canvas.create_text(x, y, text='PYTHON')
canvas.postscript(file="my_drawing.ps", colormode='color')
inside docker
docker run --rm
-e DISPLAY=$DISPLAY
-v /tmp/.X11-unix:/tmp/.X11-unix
-v $PWD:/app
python:3.5.2-alpine python /app/test.py
However I have xvfb on my machine and it's also inside container after docker add so I don't really understand how to run tkinter without touching env $DISPLAY
Does anybody experienced similar problem?
Thanks