Skip to content

Conversation

fredmain
Copy link

@fredmain fredmain commented May 4, 2025

Description

This pull request fixes an issue in the CTkSwitch widget where the onvalue and offvalue parameters could only be set during initialization, but not via the configure() method.

Trying to use .configure(onvalue=..., offvalue=...) would raise a ValueError due to missing handling for those parameters in the method.

Reproduction

import customtkinter

root = customtkinter.CTk()
s = customtkinter.CTkSwitch(root)
s.configure(onvalue='manual', offvalue='automatic')  # 💥 ValueError before this fix
s.pack()
root.mainloop()

Fix

I added handling for onvalue and offvalue inside the configure() method of CTkSwitch, following the same pattern used for other supported keyword arguments like text, state, and variable.
Let me know if I should add test cases or adjust anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant