TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
11.33k stars 1.07k forks source link

Redefine the window size after changing the scale #2082

Open DimaTepliakov opened 10 months ago

DimaTepliakov commented 10 months ago

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.

Akascape commented 10 months ago

@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.

KarthikBammidi3369 commented 10 months ago

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.

DimaTepliakov commented 10 months ago

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.

KarthikBammidi3369 commented 10 months ago

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.

DimaTepliakov commented 10 months ago

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.gridforget()?

KarthikBammidi3369 commented 10 months ago

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.gridforget()?

Its working now, Thanks

DimaTepliakov commented 10 months ago

@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?

Akascape commented 10 months ago

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