mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
naming
This commit is contained in:
@@ -36,7 +36,7 @@ class CalculatorApp(App):
|
|||||||
Static(id="numbers"),
|
Static(id="numbers"),
|
||||||
Button("AC", id="ac"),
|
Button("AC", id="ac"),
|
||||||
Button("C", id="c"),
|
Button("C", id="c"),
|
||||||
Button("+/-", id="plus_minus"),
|
Button("+/-", id="plus-minus"),
|
||||||
Button("%", id="percent"),
|
Button("%", id="percent"),
|
||||||
Button("÷", id="divide", variant="warning"),
|
Button("÷", id="divide", variant="warning"),
|
||||||
Button("7", id="number-7"),
|
Button("7", id="number-7"),
|
||||||
@@ -84,7 +84,7 @@ class CalculatorApp(App):
|
|||||||
if button_id.startswith("number-"):
|
if button_id.startswith("number-"):
|
||||||
number = button_id.partition("-")[-1]
|
number = button_id.partition("-")[-1]
|
||||||
self.numbers = self.value = self.value.lstrip("0") + number
|
self.numbers = self.value = self.value.lstrip("0") + number
|
||||||
elif button_id == "plus_minus":
|
elif button_id == "plus-minus":
|
||||||
self.numbers = self.value = str(Decimal(self.value or "0") * -1)
|
self.numbers = self.value = str(Decimal(self.value or "0") * -1)
|
||||||
elif button_id == "percent":
|
elif button_id == "percent":
|
||||||
self.numbers = self.value = str(Decimal(self.value or "0") / Decimal(100))
|
self.numbers = self.value = str(Decimal(self.value or "0") / Decimal(100))
|
||||||
|
|||||||
Reference in New Issue
Block a user