From 2b0958f638732a42e42e9c8f05f7335b7068d531 Mon Sep 17 00:00:00 2001 From: ChiaraW1 Date: Wed, 13 May 2026 12:28:45 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Button=20hinzugef=C3=BCgt,=20funktioniert?= =?UTF-8?q?=20noch=20nicht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- station_monitor.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/station_monitor.py b/station_monitor.py index ffa236c..96aa8b6 100644 --- a/station_monitor.py +++ b/station_monitor.py @@ -6,3 +6,38 @@ haTerm is a Terminal Based hafas client, using the ivb endpoint. Prompt_toolkit (https://github.com/prompt-toolkit/python-prompt-toolkit) will be used to render a terminal user interface (TUI). The application will provide routing information and station departures/arrivals. """ + +from prompt_toolkit import Application +from prompt_toolkit.buffer import Buffer +from prompt_toolkit.layout.layout import Layout +from prompt_toolkit.layout.containers import Window, VSplit, HSplit +from prompt_toolkit.layout.controls import BufferControl +from prompt_toolkit.widgets import Button + + +hstelle=Buffer() + + + +def button_handler(): + print("Haltestelle") + + +monitor = Button(text= "Monitor", handler= button_handler, width= 12, left_symbol= '<', right_symbol= '>') + +root_container= HSplit(children=[ + VSplit(children=[ + monitor, + Window(width=1, char='│', style="fg:#9D1D75"), + ]), + Window(height=1, char='', style="bg:#9D1D75"), + + +]) + +layout = Layout(root_container) + + + +app = Application(layout=layout, full_screen=True) +app.run() \ No newline at end of file From 1ca7ce751a3508e6e80d1376e7d79a8e0ef24908 Mon Sep 17 00:00:00 2001 From: Sophia S Date: Wed, 13 May 2026 12:31:49 +0200 Subject: [PATCH 2/2] added structure, code is runable --- route_planning.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/route_planning.py b/route_planning.py index 4d1ead3..64e4a1d 100644 --- a/route_planning.py +++ b/route_planning.py @@ -6,3 +6,36 @@ haTerm is a Terminal Based hafas client, using the ivb endpoint. Prompt_toolkit (https://github.com/prompt-toolkit/python-prompt-toolkit) will be used to render a terminal user interface (TUI). The application will provide routing information and station departures/arrivals. """ +#routenplanung mit promt tool kit + +import prompt_toolkit as pk +import time +from prompt_toolkit import Application +from prompt_toolkit.buffer import Buffer +from prompt_toolkit.layout.containers import HSplit, VSplit, Window +from prompt_toolkit.layout.controls import BufferControl +from prompt_toolkit.layout.layout import Layout +from prompt_toolkit.key_binding import KeyBindings + +kb = KeyBindings() +startBuffer = Buffer() +endBuffer = Buffer() + + +root_container = HSplit(children=[ + HSplit(children=[ + Window(content=BufferControl(buffer=startBuffer, focusable=True)), + Window(width=1, char='-', style="fg:#2A71D5"), + + Window(content=BufferControl(buffer=endBuffer, focusable=True)) + ]), + Window(height=1, char=' ', style="bg:#2A71D5 fg:black"), + #Window(content=BufferControl(buffer=userBuffer),height=4), +]) + +layout = Layout(root_container) + +app = Application(layout=layout, key_bindings=kb, full_screen=True) + +app.run() +