How to align an image and text on different sides of a button in python tkinter?

193 Views Asked by At

There's no spacing between the text and the image. There's only spacing between the edge of the button and the text + image

I want to make a button with text on the left and an image on the right. The button is supposed to have a certain length. The text should start at the left side of the button and the image is supposed to be on the right side of the button. The problem is, when I use compound and make the button bigger, the text and image are centered.

I don't really want to add spaces to the text but I would do it if nothing else works.

import tkinter as tk
from tkinter import ttk

root = tk.Tk()
root.geometry('500x300+100+100')

that_image = tk.PhotoImage(file = 'that_image.png')

buttonlol = ttk.Button(root,width = 20,text = "That's text",image = that_image,compound = "right").pack()

root.mainloop()

Thank you all!

0

There are 0 best solutions below