I'm trying to learn to use python TTK, i keep getting an error when adding a simple little image to a button, can be any image in the same file as the program. This is the code :
# from PIL import ImageTk, Image
from tkinter import *
from tkinter import ttk
from PIL import ImageTk, Image
window = Tk()
window.wm_iconbitmap('icon.ico')
window.geometry('200x200')
user = ttk.Label(window, text='Username').pack()
userEnt = ttk.Entry(window).pack()
passW = ttk.Label(window, text='Password').pack()
passEnt = ttk.Entry(window).pack()
logButton = ttk.Button(window, text='Login').pack()
myImg = PhotoImage(file='C:\\Users\edwin\Desktop\Python\Tkinter\logo.png')
logButton.config(image=myImg, compound=RIGHT)
window.mainloop()
This is the error I am receiving and I don't know why!
File "C:/Users/edwin/Desktop/Python/Tkinter/trial.py", line 18, in logButton.config(image=myImg, compound=RIGHT) AttributeError: 'NoneType' object has no attribute 'config'