My problem is:
When the new window open (new_mame_win) it's not showing the image.
Code:
import random
import requests
from tkinter import *
from PIL import ImageTk, Image
root = Tk()
root.title("random mame gen")
mame_list = [
"https://www.codeitbro.com/wp-content/uploads/2020/07/funny-python-programming-meme-8-python-is-easier-to-learn.jpg",
"https://www.codeitbro.com/wp-content/uploads/2020/07/python-funny-meme-6-lists.jpg",
"https://www.codeitbro.com/wp-content/uploads/2020/07/hilarious-python-meme-4-python-is-op.jpg",
"https://www.codeitbro.com/wp-content/uploads/2020/07/hilarious-python-meme-10-before-and-after-coding.jpg",
"https://www.codeitbro.com/wp-content/uploads/2020/07/python-meme-12-does-your-python-bite.jpg",
"https://www.codeitbro.com/wp-content/uploads/2020/07/python-funny-memes-featured-image.jpg",
"https://www.codeitbro.com/wp-content/uploads/2020/07/python-meme-2-first-python-program.jpg"
]
def new_mame_btn_def():
new_mame_win = Toplevel()
random_mame_choice = random.choice(mame_list)
get_the_random_mame_img = requests.get(random_mame_choice)
random_mame_img = open("random_mame_img.jpg", "wb")
random_mame_img.write(get_the_random_mame_img.content)
show_the_random_mame_choice_img = ImageTk.PhotoImage(Image.open("random_mame_img.jpg"))
show_the_random_mame_choice_img_Label = Label(new_mame_win, Image=show_the_random_mame_choice_img)
show_the_random_mame_choice_img_Label.pack(side="bottom", fill="both", expand="yes")
new_mame_btn = Button(root, text="open new mame", command=new_mame_btn_def)
new_mame_btn.pack()
mainloop()