Skip to content

Conversation

@BlueJayVRStudio
Copy link

Adds support for passing the current dial value to the command callback across all dial types. Each dial now calls command(value) when its value changes, with a fallback to command() for backward compatibility. This enables proper on-change behavior without needing to call get(), while keeping existing code working. Multiple files were updated because the project has several separate dial classes, but the change is mechanical and consistent.

Previously, the callback received no information about the dial state, and there was no way to reconfigure the callback through the widget API. This meant the only practical way to access the current value inside a callback was to store the dial instance externally (for example in a global dictionary) and call get() from there. This pattern works, but it forces tight coupling between application code and widget instances, and prevents the use of simple reusable callbacks. Passing the value directly makes the widget easier to use, matches the conventions of other Tkinter widgets (such as Scale), and avoids the need for external lookup structures.

Usage example:

def on_change(value):
    print("Dial changed to:", value)

Dial(root, command=on_change)

Zero-argument callbacks still work as before.

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