Im trying to display the conversion of currency in my textEdit widget. I converted my .ui to .py and am using radioButtons to select currencies, I can input my number and select my currencies but it wont display the calculated outcome Here is the last bit of my code not including setup_ui:
def convert_currency(self):
conversion_rates = {
"$ US":1.0,
"GB P":0.72,
"Euro":0.85,
"Yen":112.54,
"Peso":20.15,
"Krona":8.47
}
self.pushButton.clicked.connect(self.convert_currency)
selected_currency = self.radioButton.currentText()
conversion_rate = conversion_rates.get(selected_currency, 1.0)
latte_cost = 3.50
cost_in_selected_currency = latte_cost * conversion_rate
self.result_label.setText(f"cost of latte:{cost_in_selected_currency}{selected_currency}")
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec())