TomSchimansky / CustomTkinter

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

CTkSwitch has got too much empty space after the text #1547

Open Yunjonue opened 1 year ago

Yunjonue commented 1 year ago

image

MaxNiark commented 1 year ago

Could you share the part of dev?

Yunjonue commented 1 year ago

searchbar = CTkEntry(window, placeholder_text='Keywords separated by spaces or commas', font=('Consolas', 16), justify='center') searchbar.grid(row=2, column=0, columnspan=8, padx=(2, 2), pady=(2, 1), sticky='we')

switch = CTkSwitch(window, text='CTkSwitch', font=('Consolas', 16), variable=var, onvalue=False, offvalue=True) switch.grid(row=2, column=7, columnspan=1, padx=(1, 2), pady=(2, 1), sticky='we')

searchbutton = CTkButton(window, textvariable=searchlabel, font=('Consolas', 16), command=search) searchbutton.grid(row=2, column=8, columnspan=2, padx=(1, 2), pady=(2, 1), sticky='we')

MaxNiark commented 1 year ago

maybe dat weight :

image

could you set the column grid and width widget ? switch.grid_columnconfigure((0,1,2),weight=0)

BAndresen commented 1 year ago

You can try lowering the init width in the switch module

Screenshot 2023-05-17 092536

ghost commented 1 year ago

You can try lowering the init width in the switch module

It's not recommended to alter a module's code locally.

ghost commented 1 year ago

@Yunjonue - If you don't like how the CTkSwitch widget has too much empty space in your project, then you can alter the width with the width attribute.

If you think that this is too much empty space for CustomTkinter in general, you can submit a PR changing this.

maybe dat weight :

could you set the column grid and width widget ? switch.grid_columnconfigure((0,1,2),weight=0)

You don't want to change the weight of the column or row because that can have unintended side effects (like thw widget filling up too much space, other widgets being misaligned, etc.). Instead, you want to change the width of the widget itself.