Python GUI with tkinter: labels with text and Images

Here is the code to put an image and a text into a label, together. The parameter to use is compund, but look at the code and the video to see what is this about.

# Label with text and image


import tkinter as tk

root = tk.Tk()
img = tk.PhotoImage(file="excel.png")
lab = tk.Label(root, text="Hello")
lab.grid()
lab["compound"] = tk.LEFT
lab["image"] = img

root.mainloop()



This is the window

The video


Subscribe to the newsletter for updates
Tkinter templates

Avatar My youtube channel

Twitter: @pythonprogrammi - python_pygame

Claude's Games

Arkanoid
Platform 2d

1. Memory game

Videos

Speech recognition game

Pygame's Platform Game

Other Pygame's posts

Advertisement