tkinter - Direct entry in the SpinBox -
consider simple code:
from tkinter import * root = tk() def update_label(): my_label.config(text = my_var.get()) my_label = label(root, text = "?") my_label.pack() my_var = intvar() spinbox(root, from_ = 1, = 10, textvariable = my_var, command = update_label).pack() root.mainloop()
the documentation @ new mexico tech states that:
the user can enter values directly, treating widget if entry.
however if enter value directly in spinbox above code, not trigger command callback.
further, can enter value in spinbox widget despite fact have restricted -from
, _to
values between 1 , 10.
my questions:
can direct entry in spinbox triggers command callback ?
can restrict value can entered directly within 1 , 10 ?
you can add trace my_var
can called everytime value changes. little more information, see:
what arguments tkinter variable trace method callbacks?
you can data validation using validate
, validatecommand
attributes of spinbox. works same entry widget, covered here:
Comments
Post a Comment