0

I have a load of Python tkinter GUI tests that run fine locally (on Windows) but do not run using GitHub Actions. The error I get is:

_tkinter.TclError: no display name and no $DISPLAY environment variable

I believe this is because there is no logical graphical interface for tkinter to use under GitHub Actions. Is there a way to indicate that I don't care about the display being visible so that my tests will run?

Paul D Smith
  • 571
  • 4
  • 15
  • Try splitting your GUI and other scripts in separate files and use a `try`/`except` when importing your GUI file. – TheLizzard May 30 '21 at 10:57
  • You could try [this](https://stackoverflow.com/a/66952101/13629335). – Thingamabobs May 30 '21 at 11:01
  • @Atlas435 Many thanks, that worked a treat. I did have to `sudo` the commands but other than that, worked first time. Now I just have to write some better tests of the GUI code :-). – Paul D Smith Jun 02 '21 at 07:29
  • Does this answer your question? [TclError: no display name and no $DISPLAY environment variable in Google Colab](https://stackoverflow.com/questions/49478228/tclerror-no-display-name-and-no-display-environment-variable-in-google-colab) – Thingamabobs Jun 02 '21 at 15:18
  • @PaulDSmith you are welcome. Im glad it worked out this way. – Thingamabobs Jun 02 '21 at 15:19

0 Answers0