Python Forum
question on tkinter canvas PhotoImage
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
question on tkinter canvas PhotoImage
#1
I want to put an image in a window above the buttons.
but the window is blank where the canvas is supposed to be.?

from tkinter import *
from PIL import ImageTk,Image
root = Tk()
root.geometry("480x480")
root.title("planets")
label =Label(root , text = "what planet would you like to know about?")
label.grid(row =15 , column = 1)

canvas = Canvas(root , width = 200 , height = 200)
canvas.grid(row = 10 , column = 3 )

photo = PhotoImage('gif.gif')
canvas.create_image(0,0 , anchor = NW, image = photo)

root.mainloop()
Reply


Messages In This Thread
question on tkinter canvas PhotoImage - by gr3yali3n - Sep-05-2020, 09:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Beginner question re: Tkinter geometry return2sender 3 1,017 Jun-19-2023, 06:19 PM
Last Post: deanhystad
  Tkinter GUI question texan1836 3 1,982 Apr-13-2023, 03:12 AM
Last Post: deanhystad
  tkinter.TclError: can't invoke "canvas" command cybertooth 8 6,257 Feb-23-2023, 06:58 PM
Last Post: deanhystad
  simple tkinter question function call not opening image gr3yali3n 5 3,597 Aug-02-2022, 09:13 PM
Last Post: woooee
  [Tkinter] question for a tkinter dialog box RobertAlvarez424 2 2,324 Aug-25-2021, 03:08 PM
Last Post: RobertAlvarez424
  [Tkinter] Clickable Rectangles Tkinter Canvas MrTim 4 9,098 May-11-2021, 10:01 PM
Last Post: MrTim
  [Tkinter] Draw a grid of Tkinter Canvas Rectangles MrTim 5 8,169 May-09-2021, 01:48 PM
Last Post: joe_momma
Thumbs Up tkinter canvas; different page sizes on different platforms? philipbergwerf 4 4,267 Mar-27-2021, 05:04 AM
Last Post: deanhystad
  Python tkinter question tablet Nick_tkinter 8 5,182 Mar-04-2021, 10:44 PM
Last Post: Larz60+
  tkinter slider question Nick_tkinter 1 2,595 Feb-22-2021, 01:31 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020