Avatar ·

Difference between @singledispatch and @overload

📁 Advanced Python Topics, Help

What is the difference between @singledispatch and @overload? Which one should be used for overriding in Python?

Avatar ·

Try this:

import tkinter as tkfrom PIL import ImageTk, Imagedef show_image(path):    root = tk.Tk()    img = Image.open(path)    width = 500    ratio = (width / float(img.size[0]))    height = int((float(img.size[1]) * float(ratio)))    imag = img.resize((width, height), Image.ANTIALIAS)    image = ImageTk.PhotoImage(imag)    panel = tk.Label(root, image=image)    panel.pack(side="top")                                

Log in to leave an answer

Blogs