Skip to content

Auto resize window #435

Answered by Akascape
frwol asked this question in Q&A
Sep 7, 2022 · 4 comments · 3 replies
Discussion options

You must be logged in to vote

@frwol I got the solution for you,

First make a separate frame which will act as the background window (do not use pady or padx).

self._window = customtkinter.CTk()
frame = customtkinter.CTkFrame(master=self._window)
frame.grid(row=0, column=0)

Create all of your widgets/sub-frames inside that main frame and then add these lines in the end of your code:

frame.update_idletasks()
width = frame.winfo_width()
height = frame.winfo_height()
self._window.geometry(f"{width}x{height}")

Here is your modified example file

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@frwol
Comment options

@Akascape
Comment options

@avalon60
Comment options

Answer selected by frwol
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants