mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-29776: Use decorator syntax for properties. (#585)
This commit is contained in:
parent
c85a26628c
commit
bdf6b910f9
10 changed files with 53 additions and 34 deletions
|
@ -1577,20 +1577,17 @@ class LabeledScale(Frame):
|
|||
self.label['text'] = newval
|
||||
self.after_idle(adjust_label)
|
||||
|
||||
|
||||
def _get_value(self):
|
||||
@property
|
||||
def value(self):
|
||||
"""Return current scale value."""
|
||||
return self._variable.get()
|
||||
|
||||
|
||||
def _set_value(self, val):
|
||||
@value.setter
|
||||
def value(self, val):
|
||||
"""Set new scale value."""
|
||||
self._variable.set(val)
|
||||
|
||||
|
||||
value = property(_get_value, _set_value)
|
||||
|
||||
|
||||
class OptionMenu(Menubutton):
|
||||
"""Themed OptionMenu, based after tkinter's OptionMenu, which allows
|
||||
the user to select a value from a menu."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue