-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Reorganize py-shiny page, remove outdated apps
- Loading branch information
Gordon Shotwell
authored
Jan 12, 2024
1 parent
a071e4d
commit 1ba1dc9
Showing
11 changed files
with
422 additions
and
619 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
/venv/ | ||
**/.venv/ | ||
**/.DS_Store | ||
/node_modules/ | ||
/packages/*.whl | ||
/dist/ | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,14 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from shiny import App, render, ui | ||
from shiny import render | ||
from shiny.express import ui, input | ||
|
||
app_ui = ui.page_fluid( | ||
ui.layout_sidebar( | ||
ui.panel_sidebar( | ||
ui.input_slider("n", "N", 0, 100, 20), | ||
), | ||
ui.panel_main( | ||
ui.output_plot("histogram"), | ||
), | ||
), | ||
) | ||
with ui.sidebar(): | ||
ui.input_slider("n", "N", 0, 100, 20) | ||
|
||
|
||
def server(input, output, session): | ||
@output | ||
@render.plot(alt="A histogram") | ||
def histogram(): | ||
np.random.seed(19680801) | ||
x = 100 + 15 * np.random.randn(437) | ||
plt.hist(x, input.n(), density=True) | ||
|
||
|
||
app = App(app_ui, server, debug=True) | ||
@render.plot(alt="A histogram") | ||
def histogram(): | ||
np.random.seed(19680801) | ||
x = 100 + 15 * np.random.randn(437) | ||
plt.hist(x, input.n(), density=True) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
from shiny import App, render, ui | ||
from shiny import render | ||
from shiny.express import ui, input | ||
|
||
app_ui = ui.page_fluid( | ||
ui.input_slider("n", "N", 0, 100, 20), | ||
ui.output_text_verbatim("txt"), | ||
) | ||
|
||
ui.input_slider("n", "N", 0, 100, 20), | ||
|
||
def server(input, output, session): | ||
@output | ||
@render.text | ||
def txt(): | ||
return f"n*2 is {input.n() * 2}" | ||
|
||
|
||
app = App(app_ui, server) | ||
@render.text | ||
def txt(): | ||
return f"n*2 is {input.n() * 2}" |
Oops, something went wrong.