1

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

# 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
New contributor
epi is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
6
  • 1
    Height is the width divided by 144? Commented Nov 24 at 15:41
  • 1
    @Snow exeWidth/16*9 does not mean exeWidth/(16*9). It means (exeWidth/16)*9. Commented Nov 24 at 23:49
  • 1
    I got exeWidth = 160 and height = 90.0 when running your code (after adding parts to make it a minimal reproducible example). Commented Nov 25 at 1:09
  • @acw1668 Yeah its always stuck at 160 no matter what I do to it. I even tried to define the width manually with ctk.CTkFrame(self, width=1000) and it still returned with 160 Commented Nov 25 at 4:39
  • Try using exeWidth = self.monitorFrame["width"] to get the initial width. Commented Nov 25 at 6:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.