Python Forum
[Tkinter] Image in Frame in Tabbed Widget
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Image in Frame in Tabbed Widget
#1
I have created a tabbed widget with 2 tabs and I put a frame in each tab. I want to place 2 images, one in each frame, but the image is not being displayed. I can get text into each frame but not an image. There are no errors being flagged and the tabbed widget is being displayed properly. What am I missing here?

Here is the code:
def tabbedPics():
   Notebook = ttk.Notebook(root, width = 317, height = 230)

    dinoFrame = ttk.Frame(Notebook)
    Notebook.add(dinoFrame, text = "Dinosaur")
    sizeFrame = ttk.Frame(Notebook)
    Notebook.add(sizeFrame, text = "Size Comparison")
    Notebook.place(x=900, y=220)

    dinoImg = ImageTk.PhotoImage(Image.open("dino_images/Anomalocaris.gif"))
    dinoLabel = Label(dinoFrame, image = dinoImg)
    dinoLabel.place(x=0, y=0)

    sizeImg = ImageTk.PhotoImage(Image.open("dinosize/Anomalocaris_size.gif"))
    sizeLabel = Label(sizeFrame, image = sizeImg)
    sizeLabel.place(x=0, y=0)
Yoriz write Sep-27-2022, 09:11 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
Image in Frame in Tabbed Widget - by Columbo - Sep-27-2022, 08:59 PM
RE: Image in Frame in Tabbed Widget - by Yoriz - Sep-27-2022, 09:09 PM
RE: Image in Frame in Tabbed Widget - by deanhystad - Sep-27-2022, 09:30 PM
RE: Image in Frame in Tabbed Widget - by Columbo - Sep-28-2022, 12:05 AM
RE: Image in Frame in Tabbed Widget - by deanhystad - Sep-28-2022, 08:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to put background image on Tkinter Frame jenkins43 2 8,860 Nov-27-2019, 11:38 AM
Last Post: jenkins43
  [Tkinter] Scrollbar, Frame and size of Frame Maksim 2 9,219 Sep-30-2019, 07:30 AM
Last Post: Maksim
  [Tkinter] create and insert a new frame on top of another frame atlass218 4 11,426 Apr-18-2019, 05:36 PM
Last Post: atlass218
  how to insert image into Text widget Tkinter atlass218 5 10,185 Apr-17-2019, 05:28 AM
Last Post: atlass218
  [Tkinter] Frame size only works if frame is empty(Solved) Tuck12173 7 6,664 Jan-29-2018, 10:44 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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