R 中的对话框

问题描述 投票:0回答:1

我正在尝试创建一个弹出对话框,询问用户他们的电子邮件地址,然后将其存储在变量中。

我尝试使用“tcltk”软件包,但无法安装在我的新版本上。有人有什么建议吗?

r dialog
1个回答
0
投票

我刚刚发布了 tinyfiledialogs 的 R 绑定。 它提供了许多模式对话框和弹出通知(图形和控制台模式)。它是跨平台的 C(windows、Mac、Unix),目标是极其易于使用。没有 init,没有主循环,也没有外部依赖项。它被 GitHub 上的数百个项目使用。

# first load the included library
dyn.load("tinyfiledialogsX64.so")

# then load the included R interface
tinyfd_openFileDialog <- function(aTitle, aDefaultPathAndFile , aNumOfFilterPatterns,
        aFilterPatterns, aSingleFilterDescription , aAllowMultipleSelects)
{
  result <- .C("tfd_openFileDialog",
                charToRaw(aTitle),
        lOpenFile = aDefaultPathAndFile ,
        as.integer(aNumOfFilterPatterns) ,
        aFilterPatterns ,
        charToRaw(aSingleFilterDescription) ,
        as.integer(aAllowMultipleSelects) )

  if ( result$lOpenFile == "NULL" ) return()
  else return(result$lOpenFile)
}

# now, you can call the dialog
tinyfd_openFileDialog( "a title" , "/Users/bardos/Documents/" , 1 , c ("*.txt","*.jpg") , "some files" , 0 )
© www.soinside.com 2019 - 2024. All rights reserved.