TomSchimansky / TomSchimansky/CustomTkinter
.bind function does not correct for widget scaling
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.6k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Consider the following code snippet:
import customtkinter
app = customtkinter.CTk()
app.title("my app")
app.geometry("200x400")
app.grid_columnconfigure(0, weight=1)
app.grid_rowconfigure(0, weight=1)
tall = customtkinter.CTkFrame(app, border_color="blue", border_width=2)
tall.grid(row=0, column=0, sticky="ns")
tall.bind("<Configure>",
lambda event: tall.configure(width=event.height))
app.mainloop()
This does not let the frame be wider than it is tall.
However, when turning on display scaling with Windows at 150%, the frame gets to 3:2 before getting restricted. This is because the configure event is not scaled back by the widget scaling amount.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the handling of the event used by widget .bind callbacks and trace how widget scaling is applied to event dimensions. Reproduce the example at 150% Windows display scaling, then verify that the frame remains square when its width is set from event.height.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100