diff options
Diffstat (limited to 'sources/pyside6/doc/tutorials/expenses')
| -rw-r--r-- | sources/pyside6/doc/tutorials/expenses/main.py | 4 | ||||
| -rw-r--r-- | sources/pyside6/doc/tutorials/expenses/main_snake_prop.py | 4 | ||||
| -rw-r--r-- | sources/pyside6/doc/tutorials/expenses/steps/10-expenses.py | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/sources/pyside6/doc/tutorials/expenses/main.py b/sources/pyside6/doc/tutorials/expenses/main.py index 2eec5defb..4dcaedb50 100644 --- a/sources/pyside6/doc/tutorials/expenses/main.py +++ b/sources/pyside6/doc/tutorials/expenses/main.py @@ -118,7 +118,7 @@ class Widget(QWidget): self.table.insertRow(self.items) description_item = QTableWidgetItem(des) - price_item = QTableWidgetItem("{:.2f}".format(float(price))) + price_item = QTableWidgetItem(f"{float(price):.2f}") price_item.setTextAlignment(Qt.AlignRight) self.table.setItem(self.items, 0, description_item) @@ -158,7 +158,7 @@ class Widget(QWidget): data = self._data if not data else data for desc, price in data.items(): description_item = QTableWidgetItem(desc) - price_item = QTableWidgetItem("{:.2f}".format(price)) + price_item = QTableWidgetItem(f"{price:.2f}") price_item.setTextAlignment(Qt.AlignRight) self.table.insertRow(self.items) self.table.setItem(self.items, 0, description_item) diff --git a/sources/pyside6/doc/tutorials/expenses/main_snake_prop.py b/sources/pyside6/doc/tutorials/expenses/main_snake_prop.py index cea2f5767..92ad2b92c 100644 --- a/sources/pyside6/doc/tutorials/expenses/main_snake_prop.py +++ b/sources/pyside6/doc/tutorials/expenses/main_snake_prop.py @@ -121,7 +121,7 @@ class Widget(QWidget): self.table.insert_row(self.items) description_item = QTableWidgetItem(des) - price_item = QTableWidgetItem("{:.2f}".format(float(price))) + price_item = QTableWidgetItem(f"{float(price):.2f}") price_item.text_alignment = Qt.AlignRight self.table.set_item(self.items, 0, description_item) @@ -161,7 +161,7 @@ class Widget(QWidget): data = self._data if not data else data for desc, price in data.items(): description_item = QTableWidgetItem(desc) - price_item = QTableWidgetItem("{:.2f}".format(price)) + price_item = QTableWidgetItem(f"{price:.2f}") price_item.text_alignment = Qt.AlignRight self.table.insert_row(self.items) self.table.set_item(self.items, 0, description_item) diff --git a/sources/pyside6/doc/tutorials/expenses/steps/10-expenses.py b/sources/pyside6/doc/tutorials/expenses/steps/10-expenses.py index 2329805a7..7e33f6acb 100644 --- a/sources/pyside6/doc/tutorials/expenses/steps/10-expenses.py +++ b/sources/pyside6/doc/tutorials/expenses/steps/10-expenses.py @@ -118,7 +118,7 @@ class Widget(QWidget): self.table.insertRow(self.items) description_item = QTableWidgetItem(des) - price_item = QTableWidgetItem("{:.2f}".format(float(price))) + price_item = QTableWidgetItem(f"{float(price):.2f}") price_item.setTextAlignment(Qt.AlignRight) self.table.setItem(self.items, 0, description_item) @@ -158,7 +158,7 @@ class Widget(QWidget): data = self._data if not data else data for desc, price in data.items(): description_item = QTableWidgetItem(desc) - price_item = QTableWidgetItem("{:.2f}".format(price)) + price_item = QTableWidgetItem(f"{price:.2f}") price_item.setTextAlignment(Qt.AlignRight) self.table.insertRow(self.items) self.table.setItem(self.items, 0, description_item) |
