Apr-07-2019, 03:51 PM
Hi jpezz
Thanks for your reply. In a label you can insert one image only! But you can place many label each containing a image in a frame container.
Here a script with totally three image label in one row: (For the trial all with the same image!)
wuf :-)
Thanks for your reply. In a label you can insert one image only! But you can place many label each containing a image in a frame container.
Here a script with totally three image label in one row: (For the trial all with the same image!)
# -*- coding: utf-8 -* try: # Import Tkinter for Python 2.xx import Tkinter as tk except ImportError: # Or import Tkinter for Python 3.xx import tkinter as tk from PIL import Image, ImageTk MAIN_WIN_TITLE = "Image Placements" MAIN_WIN_XPOS = 100 MAIN_WIN_YPOS = 100 MAIN_WIN_WIDTH = 800 MAIN_WIN_HEIGHT = 600 main_win = tk.Tk() main_win.title(MAIN_WIN_TITLE) # Placement of the main window main_win.geometry("{}x{}+{}+{}".format( MAIN_WIN_WIDTH, MAIN_WIN_HEIGHT, MAIN_WIN_XPOS, MAIN_WIN_YPOS)) # Get the .jpg image and convert it from pil-format to tk-format pil_image_a = Image.open("pngs/a.jpg") main_win.tk_image_a = ImageTk.PhotoImage(pil_image_a) image_container = tk.Frame(main_win) image_container.pack() # Place first image-label in the image-container image_label = tk.Label(image_container, text="Image-1", compound='bottom', image=main_win.tk_image_a) image_label.grid(row=0, column=0) # Place second image-label to the left side of first label # in the image-container image_label = tk.Label(image_container, text="Image-2", compound='bottom', image=main_win.tk_image_a) image_label.grid(row=0, column=1) # Place third image-label to the left side of second label # in the image-container image_label = tk.Label(image_container, text="Image-3", compound='bottom', image=main_win.tk_image_a) image_label.grid(row=0, column=2) main_win.mainloop()What is the size of your images?
wuf :-)