0

Anybody know how to fix the below error in Python 3 in Jupyter Notebook ? I am running the below code:-

from tkinter import *

master = Tk()
#screen.geometry("500x500")
#screen.title("Campaign")

Label(master, text="First Name").grid(row=0)
Label(master, text="Last Name").grid(row=1)

e1 = Entry(master)
e2 = Entry(master)

e1.grid(row=0, column=1)
e2.grid(row=1, column=1)

mainloop()

This throws an error :- TclError: no display name and no $DISPLAY environment variable

jizhihaoSAMA
  • 12,336
  • 9
  • 27
  • 49
SeekAns
  • 1
  • 2
  • Have you configured your tkinter rightly?What will happen if you run this code in the command prompt? – jizhihaoSAMA Jun 21 '20 at 09:16
  • 1
    Does this answer your question? [_tkinter.TclError: no display name and no $DISPLAY environment variable](https://stackoverflow.com/questions/37604289/tkinter-tclerror-no-display-name-and-no-display-environment-variable) – stovfl Jun 21 '20 at 09:23
  • Thank you @jizhihaoSAMA for responding. I tried the same code is VS editor. It is working. However I have to do it in Jupiter notebook. I did not try in command like. (LL try) . Can you tell me what should I configure my tkinter. (I am also quite new to the python ) – SeekAns Jun 21 '20 at 16:52
  • I haven't used Jupyter Notebook.Can't help you anymore. – jizhihaoSAMA Jun 22 '20 at 03:09

0 Answers0