CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

Redefine the window size after changing the scale

Open DimaTepliakov opened this issue 1 year ago • 8 comments

Hello everyone,

I hope this is the appropriate place to seek assistance.

I've created a graphical user interface using the fantastic library, and I've run into an issue. When switching between windows in the navigation frame, the window size adjusts correctly based on the included widgets. However, after selecting a specific scale, the window size remains constant for all windows. I've attached a video illustrating this problem:

https://github.com/TomSchimansky/CustomTkinter/assets/69217590/eb604a5d-63cb-4394-9407-d457424a78e4

I'm eager to learn how to dynamically adjust the window size according to the widgets, even after changing the scale.

Additionally, I've observed that the transition between windows can be a bit abrupt, sometimes causing screen flickering with black backgrounds. Is there a way to minimize this?

Thank you in advance for any assistance provided.

DimaTepliakov avatar Nov 15 '23 13:11 DimaTepliakov

@DimaTepliakov Probably a bug. You can also use the geometry method to resize the window. self.geometry(f"{frame_width}x{frame_height}"). But for this you have to calculate the right + left frame's width and right frame's height.

Akascape avatar Nov 16 '23 10:11 Akascape

Hi @DimaTepliakov, I'm trying to create similar view when button clicked need to change the frame. Can you help me how did you created this view with sample code would help me. I appreciate your efforts in making this view.

Thanks in Advance.

KarthikBammidi3369 avatar Nov 18 '23 03:11 KarthikBammidi3369

Hi @DimaTepliakov, I'm trying to create similar view when button clicked need to change the frame. Can you help me how did you created this view with sample code would help me. I appreciate your efforts in making this view.

Thanks in Advance.

I use the customtkinter image example in order to create something as a basis to this view.

DimaTepliakov avatar Nov 19 '23 14:11 DimaTepliakov

Hi @DimaTepliakov, I'm trying to create similar view when button clicked need to change the frame. Can you help me how did you created this view with sample code would help me. I appreciate your efforts in making this view. Thanks in Advance.

I use the customtkinter image example in order to create something as a basis to this view.

Thank you @DimaTepliakov Just now I have tried this, but in my frame, I have multiple value entries, combo box etc. which is getting reset whenever I switch back to same frame. I need frame should restore to user given values. even after switching to other frames.

KarthikBammidi3369 avatar Nov 19 '23 16:11 KarthikBammidi3369

Hi @DimaTepliakov, I'm trying to create similar view when button clicked need to change the frame. Can you help me how did you created this view with sample code would help me. I appreciate your efforts in making this view. Thanks in Advance.

I use the customtkinter image example in order to create something as a basis to this view.

Thank you @DimaTepliakov Just now I have tried this, but in my frame, I have multiple value entries, combo box etc. which is getting reset whenever I switch back to same frame. I need frame should restore to user given values. even after switching to other frames.

Are you using the methods: frame.grid(row=0, column=1, sticky="nsew") and frame.grid_forget()?

DimaTepliakov avatar Nov 20 '23 11:11 DimaTepliakov

Hi @DimaTepliakov, I'm trying to create similar view when button clicked need to change the frame. Can you help me how did you created this view with sample code would help me. I appreciate your efforts in making this view. Thanks in Advance.

I use the customtkinter image example in order to create something as a basis to this view.

Thank you @DimaTepliakov Just now I have tried this, but in my frame, I have multiple value entries, combo box etc. which is getting reset whenever I switch back to same frame. I need frame should restore to user given values. even after switching to other frames.

Are you using the methods: frame.grid(row=0, column=1, sticky="nsew") and frame.grid_forget()?

Its working now, Thanks

KarthikBammidi3369 avatar Nov 20 '23 13:11 KarthikBammidi3369

@DimaTepliakov Probably a bug. You can also use the geometry method to resize the window. self.geometry(f"{frame_width}x{frame_height}"). But for this you have to calculate the right + left frame's width and right frame's height.

Is there a simple way to measure all the widget's height and width in selected window?

DimaTepliakov avatar Nov 21 '23 11:11 DimaTepliakov

@DimaTepliakov widget.winfo_reqheight() and widget.winfo_reqwidth() are more efficient in measuring the frames.

Akascape avatar Nov 21 '23 12:11 Akascape