Skip to content

add trace / update on Sliders on external variable change#12

Open
sayofan wants to merge 2 commits intoharshvinay752:mainfrom
sayofan:write-trace
Open

add trace / update on Sliders on external variable change#12
sayofan wants to merge 2 commits intoharshvinay752:mainfrom
sayofan:write-trace

Conversation

@sayofan
Copy link

@sayofan sayofan commented Jan 9, 2026

This one is pretty straightforward.

If the TkVar (I used IntVars) is changed from another widget, update the slider position.

This does not enforce the not-crossing-each-other on manipulations made by other widgets.
I tried to include that but it would only work if I define the code outside the RangedSlider.

It can, however be nicely done on the variables with something like for both the variables.

def check_limit_var_left(*args):
      update_val = hLeft.get()
      if update_val>hRight.get():
          hLeft.set(min(update_val, hRight.get()))

hLeft.trace_add("write", check_limit_var_left)

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