[Python] Python Customtkinter: Getting real widget size

Discussão em 'Python' iniciado por Stack, Novembro 24, 2025.

  1. Stack

    Stack Membro Participativo

    #Monitor frame
    self.monitorFrame = ctk.CTkFrame(self)
    self.monitorFrame.grid_columnconfigure(0,weight = 1)
    self.monitorFrame.grid_rowconfigure(0,weight = 0)
    self.monitorFrame.grid_rowconfigure(1,weight = 0)
    self.monitorFrame.grid_rowconfigure(2,weight = 0)
    self.monitorFrame.grid(row = 0, column = 1, padx = 20, pady = 20, sticky = "nsew")
    self.monitorFrame.update()
    exeWidth = int(self.monitorFrame.winfo_height()-40)
    print(exeWidth)
    height = exeWidth/16*9


    I seem to be always getting 120 for both height and width, I don't know why it refuses to give me the real value for the width so I can make the maintain the height in a 16:9 ratio

    Continue reading...

Compartilhe esta Página