I'm trying to transform a method into a int (i need to divide the method value for 2)
width = int(post.width) / 2
height = int(post.height) / 2
but it gives me this error:
TypeError: int() argument must be a string, a bytes-like object or a number, not 'method'
Is there any method to do it?
Edit: For those who're trying to help me, i want to import an image (with Pil, tkinter) but with the half of his size.
post1 = Image.open(directory)
width = int(post.width) / 2
height = int(post.height) / 2
canvas=Canvas(root,width=width,height=height)
canvas.create_image(0,0,anchor=NW,image=post)
canvas.pack(padx=20, pady=20)
Also, if you need it, i provide you the complete script:
from minio import Minio
import tkinter as tk
from tkinter import *
from PIL import Image, ImageTk
import random
import os
root = Tk()
root.title("Ripetra")
width_value = root.winfo_screenwidth()
height_value = root.winfo_screenheight()
minio = Minio('myip',
access_key='key',
secret_key='key',
)
immagini = minio.list_objects('ripetra', recursive=True)
names = [img2.object_name for img2 in immagini]
image = random.choice(names)
imagecanvas = minio.fget_object("ripetra", image, "cont/ft/" + image)
dir = os.path.join("cont/ft/", image)
post1 = Image.open(dir)
resized = post1.resize((width_value, height_value), Image.ANTIALIAS)
post = ImageTk.PhotoImage(resized)
width = int(post.width()) / 2
height = int(post.height()) / 2
canvas=Canvas(root,width=width,height=height)
canvas.create_image(0,0,anchor=NW,image=post)
canvas.pack(padx=20, pady=20)
root.mainloop()