MCPcopy Index your code
hub / github.com/python/cpython / _adjust

Method _adjust

Lib/tkinter/ttk.py:1546–1571  ·  view source on GitHub ↗

Adjust the label position according to the scale.

(self, *args)

Source from the content-addressed store, hash-verified

1544
1545
1546 def _adjust(self, *args):
1547 """Adjust the label position according to the scale."""
1548 def adjust_label():
1549 self.update_idletasks() # "force" scale redraw
1550
1551 x, y = self.scale.coords()
1552 if self._label_top:
1553 y = self.scale.winfo_y() - self.label.winfo_reqheight()
1554 else:
1555 y = self.scale.winfo_reqheight() + self.label.winfo_reqheight()
1556
1557 self.label.place_configure(x=x, y=y)
1558
1559 from_ = _to_number(self.scale['from'])
1560 to = _to_number(self.scale['to'])
1561 if to < from_:
1562 from_, to = to, from_
1563 newval = self._variable.get()
1564 if not from_ <= newval <= to:
1565 # value outside range, set value back to the last valid one
1566 self.value = self._last_valid
1567 return
1568
1569 self._last_valid = newval
1570 self.label['text'] = newval
1571 self.after_idle(adjust_label)
1572
1573 @property
1574 def value(self):

Callers

nothing calls this directly

Calls 3

_to_numberFunction · 0.85
after_idleMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected