0

i got the following error when try to run the following program:

_tkinter.TclError: image "pyimage2" doesn't exist

When i use TopLevel() instead of tkinter.Tk() i got that there is 2 window appears and the second window is main window .After click "Login Buton" same(2nd) window appears again

root = tkinter.Tk()

root.title("Facebook Analayzer")

main_font = ("URW Gothic L", 15, "bold")

main_font1 = ("URW Gothic L", 10, "bold")

font3 = ("Nimbus Mono L", 8, "bold")

root.maxsize(height=500, width=500)

root.minsize(height=500, width=500)

canvas = Canvas(root, width=256, height=256)

canvas.pack()

img = PhotoImage(file="fb.png")

canvas.create_image(20, 20, anchor=NW, image=img)

w = Label(root, text="Username", width=40)

w.config(font=main_font, fg="black")

w.pack()

e1 = Entry(root, width="30", bg="yellow")

e1.pack()

Copy from Comment: Login Button is present at last line of code that is:

b1 = Button(root, 
            text="Login", bg="blue", fg="white", height="2", width="15",
            command=start_prog
           )
b1.config(font=main_font1) 
b1.pack()
stovfl
  • 14,998
  • 7
  • 24
  • 51
Atul Maurya
  • 3
  • 2
  • 4
  • i don't see a `Login Button` anywhere in your code... please share all relevant parts of your program. – Flob Dec 22 '18 at 16:14
  • Login Button is present at last line of code that is: b1 = Button(root, text="Login", bg="blue", fg="white", height="2", width="15", command=start_prog) b1.config(font=main_font1) b1.pack() – Atul Maurya Dec 22 '18 at 16:18
  • Follow this pattern [Tkinter Program](http://effbot.org/tkinterbook/tkinter-hello-again.htm) and read about [When to use the Toplevel Widget](http://effbot.org/tkinterbook/toplevel.htm) – stovfl Dec 22 '18 at 16:34
  • *"_tkinter.TclError: image “pyimage2” doesn't exist"*: Read the Answer from [_tkinter.TclError: image “…” doesn't exist](https://stackoverflow.com/a/45669789/7414759) – stovfl Dec 22 '18 at 16:46

1 Answers1

1

Try using img = tkinter.PhotoImage(file="fb.png")

and no tkinter.toplevel() is needed.

  • Hello Prithivi Raj ! It is better to give a comment if your answer is short and does not solve the question fully ! – Pluto May 27 '20 at 13:32