2

I have a problem when I want to use the tkinter module in jupyterhub. actually I want to create a GUI but when I initialize my window he display to me this error : TclError: no display name and no $DISPLAY environment variable

my code :

from tkinter import *
# window basic 
window = Tk()

# gui label
champ_label = Label(fenetre, text="test !")

# print in window
champ_label.pack()

# quit
fenetre.mainloop()

error code :

---------------------------------------------------------------------------
TclError                                  Traceback (most recent call last)
<ipython-input-2-ca11bfa7d03d> in <module>
      1 from tkinter import *
      2 # window basic
----> 3 window = Tk()
      4 
      5 # gui label

/opt/cloudera/parcels/ANACONDA_PYTHON/lib/python3.7/tkinter/__init__.py in __init__(self, screenName, baseName, className, useTk, sync, use)
   2021                 baseName = baseName + ext
   2022         interactive = 0
-> 2023         self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
   2024         if useTk:
   2025             self._loadtk()

TclError: no display name and no $DISPLAY environment variable

Thank you in advance for your answer. VC

  • Does this answer your question? [TclError: no display name and no $DISPLAY environment variable](https://stackoverflow.com/a/52906248/7414759) – stovfl Jun 18 '20 at 10:30

0 Answers0