So, the thing is, I'm currently trying to make a minecraft tellraw command generator. I didn't make the menu yet, and I'm trying to display an image inside of canvas with TKinter. The canvas does display, and it does work. But when I try to print an image inside of it using the function "create_image", this error appears when I try to use the pack function :
Traceback (most recent call last):
File "C:\Users\PC\Desktop\Python\Algorithms\Minecraft Generator\index.py", line 34, in <module>
MAIN_MENU_TELLRAW_IMAGE.pack()
AttributeError: 'int' object has no attribute 'pack'
Here is my code :
from tkinter import *
# Window
window = Tk()
window.title('Minecraft Generator')
window.geometry("1080x600")
window.minsize(1080, 600)
window.maxsize(1080, 600)
window.iconbitmap('assets/img/logo.ico')
# Config
window.config(background='#627f1f')
#Composants
# Main Menu Title
TITLE_FRAME = Frame(window, bg='#627f1f')
MAIN_MENU_TITLE = Label(TITLE_FRAME, text='Minecraft Generator' , font=("Courrier", 40), bg='#627f1f' , fg='white')
MAIN_MENU_SUBTITLE = Label(TITLE_FRAME, text='A Minecraft Generator for all needs !' , font=("Courrier", 15), bg='#627f1f' , fg='white')
# Main Menu TellRaw
MAIN_MENU_TELLRAW_BUTTON = Button(TITLE_FRAME, text='Tellraw Command', bg='white' , fg='#627f1f' , font=("Courrier News", 15))
MAIN_MENU_TELLRAW_IMAGE = Canvas(window, width=157, height=100)
MAIN_MENU_TELLRAW_IMAGE = MAIN_MENU_TELLRAW_IMAGE.create_image((157, 100), image=PhotoImage(file='assets/img/tellraw_logo.png'))
# Packing
# Title Frame
MAIN_MENU_TITLE.pack()
MAIN_MENU_SUBTITLE.pack()
TITLE_FRAME.pack(side='top')
# TellRaw
MAIN_MENU_TELLRAW_BUTTON.pack(pady=25)
MAIN_MENU_TELLRAW_IMAGE.pack()
# Display Window
window.mainloop()
I reeally don't have a clue of why this error is happening... If someone could help me, it would be kind ^^