MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _adjust

Method _adjust

tools/python-3.11.9-amd64/Lib/tkinter/ttk.py:1536–1561  ·  view source on GitHub ↗

Adjust the label position according to the scale.

(self, *args)

Source from the content-addressed store, hash-verified

1534
1535
1536 def _adjust(self, *args):
1537 """Adjust the label position according to the scale."""
1538 def adjust_label():
1539 self.update_idletasks() # "force" scale redraw
1540
1541 x, y = self.scale.coords()
1542 if self._label_top:
1543 y = self.scale.winfo_y() - self.label.winfo_reqheight()
1544 else:
1545 y = self.scale.winfo_reqheight() + self.label.winfo_reqheight()
1546
1547 self.label.place_configure(x=x, y=y)
1548
1549 from_ = _to_number(self.scale['from'])
1550 to = _to_number(self.scale['to'])
1551 if to < from_:
1552 from_, to = to, from_
1553 newval = self._variable.get()
1554 if not from_ <= newval <= to:
1555 # value outside range, set value back to the last valid one
1556 self.value = self._last_valid
1557 return
1558
1559 self._last_valid = newval
1560 self.label['text'] = newval
1561 self.after_idle(adjust_label)
1562
1563 @property
1564 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