๋ชฉ์ฐจ
def button_plus_minus_clicked(self):
operation_solution=self.operation_solution.text()
if float(operation_solution) >0:
if float(operation_solution).is_integer:
operation_solution =int(operation_solution)*(-1)
else:
operation_solution =float(operation_solution)*(-1)
else:
if float(operation_solution).is_integer:
operation_solution =int(operation_solution)*(-1)
else:
operation_solution=float(operation_solution)*(-1)
self.operation_solution.setText(str(operation_solution))
(์).is_interger์ ํตํด์ ์ ์์ธ์ง ์ค์์ธ์ง ํ์ธํ ์ ์๋ค.
728x90
'2022 > ์คํ์์ค ์ํํธ์จ์ด ํ๋ก์ ํธ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
= ๋ฒํผ ์ด๋ฒคํธ (0) | 2022.11.27 |
---|---|
. ๋ฒํผ ๊ธฐ๋ฅ ์ถ๊ฐ ์์ (0) | 2022.11.27 |
UI ์์ ํ๊ธฐ (0) | 2022.11.23 |
QGridLayout (0) | 2022.11.23 |
GUI ๊ฐ์ 5 (0) | 2022.11.23 |