Ttk Scale widget is typically used to control the numeric value of a linked variable that varies uniformly over some range.
| 1032 | |
| 1033 | |
| 1034 | class Scale(Widget, tkinter.Scale): |
| 1035 | """Ttk Scale widget is typically used to control the numeric value of |
| 1036 | a linked variable that varies uniformly over some range.""" |
| 1037 | |
| 1038 | def __init__(self, master=None, **kw): |
| 1039 | """Construct a Ttk Scale with parent master. |
| 1040 | |
| 1041 | STANDARD OPTIONS |
| 1042 | |
| 1043 | class, cursor, style, takefocus |
| 1044 | |
| 1045 | WIDGET-SPECIFIC OPTIONS |
| 1046 | |
| 1047 | command, from, length, orient, to, value, variable |
| 1048 | """ |
| 1049 | Widget.__init__(self, master, "ttk::scale", kw) |
| 1050 | |
| 1051 | |
| 1052 | def configure(self, cnf=None, **kw): |
| 1053 | """Modify or query scale options. |
| 1054 | |
| 1055 | Setting a value for any of the "from", "from_" or "to" options |
| 1056 | generates a <<RangeChanged>> event.""" |
| 1057 | retval = Widget.configure(self, cnf, **kw) |
| 1058 | if not isinstance(cnf, (type(None), str)): |
| 1059 | kw.update(cnf) |
| 1060 | if any(['from' in kw, 'from_' in kw, 'to' in kw]): |
| 1061 | self.event_generate('<<RangeChanged>>') |
| 1062 | return retval |
| 1063 | |
| 1064 | |
| 1065 | def get(self, x=None, y=None): |
| 1066 | """Get the current value of the value option, or the value |
| 1067 | corresponding to the coordinates x, y if they are specified. |
| 1068 | |
| 1069 | x and y are pixel coordinates relative to the scale widget |
| 1070 | origin.""" |
| 1071 | return self.tk.call(self._w, 'get', x, y) |
| 1072 | |
| 1073 | |
| 1074 | class Scrollbar(Widget, tkinter.Scrollbar): |