小编Ale*_*ida的帖子

updateSelectizeInput 在一个闪亮的模块中

我想使用反应值来加载控制 selectizeInput 小部件。我可以使用一个简单的闪亮应用程序来做到这一点,但是当我尝试在模块中重新组织它时,我似乎无法复制它。

在下面的代码中,我有一个带有输入小部件和按钮的简单应用程序。按下按钮后,我希望使用selectizeInput()反应变量中存储的值更新小部件。

library(shiny)

# GLOBAL VAR TO BE LOADED after pressing the button
# -------------
STORED <- reactiveValues(choices = c("a", "b", "c")
                         , selected = c("c"))

# UI
# -------------
ui <- fixedPage(
  wellPanel(
    # input widget
    selectInput("widget1"
                , "label"
                ,choices = c("WRONG A","WRONG B","WRONG C")
                ,selected="WRONG A"
                )

    # update button
    , actionButton("plotBtn"
                   , "update"
                   , class = "btn-primary")
  )
)

# SERVER
# -------------
server <- function(input, output, session) {

  observeEvent(input$plotBtn,{
    message("update button was …
Run Code Online (Sandbox Code Playgroud)

r shiny selectize.js

5
推荐指数
1
解决办法
8027
查看次数

在另一个 jupyter 单元的 %%bash 单元中声明的访问变量

在 jupyter 笔记本中,我有一个 bash jupyter 单元,如下所示:

%%bash

export MYVAR="something"
Run Code Online (Sandbox Code Playgroud)

我想$MYVAR在不同的 python 单元中访问。例如

print(MYVAR)
Run Code Online (Sandbox Code Playgroud)

我希望单元格打印“东西”,但我收到一条 NameError 消息。

示例图像: 在此处输入图片说明

python jupyter-notebook jupyter-lab

5
推荐指数
1
解决办法
173
查看次数

标签 统计

jupyter-lab ×1

jupyter-notebook ×1

python ×1

r ×1

selectize.js ×1

shiny ×1