-
-
Save wch/e62218aa28bf26e785fc6cb99efe8efe to your computer and use it in GitHub Desktop.
Test app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
from shiny import ui, render, App, Inputs, Outputs, Session | |
app_ui = ui.page_fluid( | |
ui.row( | |
ui.column( | |
6, ui.input_slider("n", "Make a Shiny square:", min=0, max=6, value=2) | |
), | |
ui.column( | |
6, | |
ui.output_ui("images"), | |
), | |
) | |
) | |
def square(x: ui.TagChild, n: int) -> ui.Tag: | |
row = ui.div([x] * n) | |
return ui.div([row] * n) | |
def server(input: Inputs, output: Outputs, session: Session): | |
@output | |
@render.ui | |
def images() -> ui.Tag: | |
img = ui.img(src="logo.png", style="width: 40px;") | |
return square(img, input.n()) | |
www_dir = Path(__file__).parent | |
app = App(app_ui, server, static_assets=www_dir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment