0

last few days I've been working to create a GUI using Tkinter

This morning my code still worked, but now it crashed with said error:

Traceback (most recent call last):
File "TKtest.py", line 3, in <module>
    master = tk.Tk()
  File "/usr/lib/python3.7/tkinter/__init__.py", line 2023, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

My code is as simple as it gets:

import tkinter as tk

master = tk.Tk()

Note: I am not using SSH. This is just my Pi 4 connected via HDMI to the 7 inch touchscreen.

How do I solve this error?

StevenCellist
  • 33
  • 1
  • 7

0 Answers0