Doner-Rechner/main.py

21 lines
686 B
Python
Raw Permalink Normal View History

2024-06-11 23:11:42 +02:00
import flet as ft
def main(page: ft.Page):
page.title = "Döner Rechner"
def d_to_g(e):
tgeld.value = str(int(tdoner.value)*int(tpreis.value))
page.update()
def g_to_d(e):
tdoner.value = str(int(tgeld.value)/int(tpreis.value))
page.update()
tpreis = ft.TextField(value=5,keyboard_type="NUMBER",scale=0.5)
tdoner = ft.TextField(on_change=d_to_g,keyboard_type="NUMBER")
tgeld = ft.TextField(on_change=g_to_d,keyboard_type="NUMBER")
page.add(ft.SafeArea(ft.Row([tpreis,ft.Text("Preis")])),
ft.Row([tdoner,ft.Text("Döner")]),
ft.Text("zu"),
ft.Row([tgeld,ft.Text("Euro")]))
ft.app(main)