I want to use ttkbootstrap to add an image to a button. However, the PNG image is not visible. What could be the problem with the code below?
Thanks a lot.
import ttkbootstrap as tkb
from pathlib import Path
from ttkbootstrap.constants import *
class test(tkb.Window):
def __init__(self, title="ttkbootstrap", themename="litera", iconphoto='',\
size=None, position=None, minsize=None, maxsize=None, resizable=None, \
hdpi=True, scaling=None, transient=None, overrideredirect=False, alpha=1):
super().__init__(title, themename, iconphoto, size, position, minsize, maxsize, resizable, hdpi, scaling, transient, overrideredirect, alpha)
IMG_PATH = Path(__file__).parent / 'images'
images = [
tkb.PhotoImage(name='main', file=IMG_PATH/'icons8-settings-32.png')
]
def image():
tkb.Button(self, image=images[0]).pack(expand=1)
image()
if __name__=='__main__':
app = test()
app.mainloop()
Not display PNG Images