Open
Description
Based on the examples, I have created an example that starts two Shiny apps. I also managed the application to run in its own window on my desktop using flaskwebgui, which also can do fastapi apps. That all works, but now I want to go to my page 2 using code and this I cannot find.
import getpass
from datetime import datetime
from fastapi import FastAPI
from flaskwebgui import FlaskUI
from shiny import App, reactive, render, ui
ui_one = ui.page_fluid(
ui.output_text("clock"),
ui.input_action_button("page_2", "Go to page2"), # THIS IS WHERE I NEED ASSISTANCE
title="A simple clock",
)
ui_two = ui.page_fluid(
ui.output_text("greeting"),
ui.input_action_button("page_1", "Go to page1"),
title="A simple greeter",
)
def server(input, output, session): # noqa
@reactive.calc
def time():
reactive.invalidate_later(1)
return datetime.now().strftime("%H:%M:%S on %B %d, %Y")
@render.text
def greeting():
return f"Hello {getpass.getuser()}!"
@render.text
def clock():
return f"It's currently {time()}."
app_one = App(ui_one, server)
app_two = App(ui_two, server)
app = FastAPI()
app.mount("/", app_one)
app.mount("/two", app_two)
FlaskUI(app=app, server="fastapi", width=800, height=600).run()
You can run this straight from the file, you do not need to use "shiny run". In PyCharm, I just select "Current file" and run it.