0

I'm running root.wm_state('zoomed') on my GUI app but it's just slightly moving my Window towards the bottom right.

I have no clue why it's happening. Can anyone help?

Minimal reproducible example:

import customtkinter as ctk

class MainApp(ctk.CTk):
        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
        
            self.title("Test Window")
            self.state('zoomed')

mapp = MainApp()
mapp.mainloop()
Canoe
  • 9
  • 2

1 Answers1

0

As customtkinter overrides .mainloop() and call .deiconify() inside the override .mainloop() if it is Windows platform, so the effect of self.wm_state('zoomed') inside __init__() is override as well.

You can delay the calling of self.wm_state('zoomed') a bit by changing that line to self.after(1, self.wm_state, 'zoomed') so it is called after the .deiconify().

import customtkinter as ctk

class MainApp(ctk.CTk):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.title("Test Window")
        self.after(1, self.wm_state, 'zoomed')

mapp = MainApp()
mapp.mainloop()
acw1668
  • 40,144
  • 5
  • 22
  • 34