找回密码
 注册
查看: 1505|回复: 0

R语言 widgetTools包 button()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-26 16:02:32 | 显示全部楼层 |阅读模式
button(widgetTools)
button()所属R语言包:widgetTools

                                        Functions to construct objects of primary widgets and render them
                                         建设主要部件的对象,使它们的功能

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

All the primary widgets such as button, text box, and so on are objects of basicPW class. The functions are constructors of primary widgets that are subjects of basicPW class with behaviors specific to primary widgets.  
所有的主要部件,如按钮,文本框等对象basicPW类。的职能是basicPW类与主要部件的具体行为主体的主要部件的构造。


用法----------Usage----------


button(wName, wEnv, wValue = "", wWidth = 12, wHeight = 0, wFuns = list(),
wNotify = list(), wPreFun = function(x) x, wPostFun = function(x) x,
wView = new("widgetView") )
entryBox(wName, wEnv, wValue = "", wWidth = 50, wHeight = 0, wFuns = list(),
wNotify = list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
textBox(wName, wEnv, wValue = "", wWidth = 25, wHeight = 12, wFuns = list(),
wNotify = list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
listBox(wName, wEnv, wValue = "", wWidth = 25, wHeight = 10, wFuns = list(),
wNotify = list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
checkButton(wName, wEnv, wValue, wWidth = 50, wFuns = list(), wNotify =
list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
radioButton(wName, wEnv, wValue, wWidth = 50, wFuns = list(), wNotify =
list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
label(wName, wEnv, wValue = "", wWidth = 0, wHeight = 0, wFuns = list(),
wNotify = list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
widget(wTitle, pWidgets, funs = list(), preFun = function()
print("Hello"), postFun = function() print("Bye"), env, defaultNames =c(
"Finish", "Cancel"))
widgetView(WVTitle, vName, widgetids = list(), theWidget = new("widget"),
winid)



参数----------Arguments----------

参数:wName
wName a character string for the name to be associated with a given primary widget
wName要与一个给定的主要部件的名称为字符串


参数:vName
vName same as wName but for a widget object
vName一样wName但为一个Widget对象


参数:wEnv
wEnv an R environment object within which the original values for each primary widget will be stored and updating and retrieval of the values will take place
wEnvR环境内,各主要部件的原始值将被存储,更新和检索值的对象会发生


参数:env
env same as wEnv but for a widget object
env一样wEnv,但为一个Widget对象


参数:wValue
wValue the initial values to be associated with a given primary widget
wValue要与一个给定的主要部件的初始值


参数:wWidth
wWidth an integer for the width of the primary widget (if applicable)  
wWidth主要部件的宽度为整数(如适用)


参数:wHeight
wHeight an integer for the height of the primary widget (if applicable)
wHeight整数为主要部件的高度(如适用)


参数:wFuns
wFuns a list of R functions that will be associated with a primary widget and invoked when an operation (e.g. click, get focus, ...) is applied to the primary widget
wFunsR的功能,将与主要部件和调用操作时(如点击,获得焦点,...)应用的主要部件列表


参数:funs
funs same as wFuns but for a widget object
funs作为wFuns但一个Widget对象


参数:wNotify
wNotify a list of functions defining the actions to be performed when the value of the primary widget changes
wNotify列表功能定义要执行的动作,当值的主要部件的变化


参数:wPreFun
wPreFun an R function that should be applied when the widget is activated
wPreFunR函数应适用的部件时被激活


参数:preFun
preFun same as wPreFun but for a view
preFun同作为wPreFun但视图


参数:wPostFun
wPostFun an R function that will be applied when the widget is inactivated
wPostFunR函数将应用于当widget被灭活


参数:postFun
postFun same as wPostFun but for a view
postFun同作为wPostFun但视图


参数:wTitle
wTitle a character string for the title to be displayed when the widget is rendered
wTitle显示为标题的字符串当widget被渲染


参数:pWidgets
pWidget a list of primary widgets (e.g. button, list box, ...) to be rendered
pWidget主要部件列表(如按钮,列表框,...)被渲染


参数:WVTitle
WVTitle same as wTitle
WVTitle作为wTitle相同


参数:widgetids
widgetids a list of tkwin ids for the primary widgets to be rendered
widgetidstkwin IDS的主要部件的列表被渲染


参数:theWidget
theWidget a widget object to render the primary widgets
theWidgetwidget对象呈现的主要部件


参数:wView
wView an object of class widgetView
wView对象类widgetView


参数:winid
winid an object of class winid
winid对象类winid


参数:defaultNames
defaultName a vector of character string of length two for the text to be shown on the two default buttons. The first is to end the process and the second to abort the process
defaultName两个默认按钮上显示的文本字符串字符的长度为二的向量。首先是要结束的过程和中止过程中的第二


Details

详情----------Details----------

button constructs a button widget object.
button构建一个按钮控件对象。

button constructs an entry box widget object.
button构造一个输入框widget对象。

textBox constructs a text box widget object.
textBox构造一个文本框widget对象。

listBox constructs a list box widget object. Value for a listbox object should be a named vector with names being the content  to be shown in the list box and values being TRUE (default value) or FALSE.
listBox构建一个列表框widget对象。 ListBox对象的值应该是一个名称的内容将显示在列表框和值TRUE(缺省值)或FALSE的命名向量。

checkButton constructs a group of check box widget objects. Value for check button objects should be a named vector with names being the content to be shown in the list box and values being TRUE (checked) or FALSE (not checked).
checkButton构造一组复选框Widget对象。检查按钮对象的值应该是一个名称的内容将显示在列表框和值是True(选中)或FALSE(不检查)的命名向量。

radioButton constructs a group of radio button widget objects. Value for radio button objects should be a named vector with names being the content to be shown in the list box and values being TRUE (default) or FALSE.
radioButton构造一组单选按钮构件对象。单选按钮对象的值应该是一个名称的内容将显示在列表框和值是True(默认)或FALSE的命名向量。

label constructs a text label widget object with the value displayed as the text.
label构造一个文本标签显示为文本的价值与widget对象。

widget constructs a widget object to render the primary widgets.
widget构建一个Widget对象呈现的主要部件。

widgetView constructs a widgetView object. This class is for internal use by class widget-class. Users trying to create GUI type widget do not need to use this class.
widgetView构造一个widgetView对象。这个类是内部使用的类widget-class。用户试图创建GUI类型的部件,不需要使用这个类。


值----------Value----------

Each constructor returns a tkwin object for the primary widget object.
每个构造函数返回一个tkwin对象主要部件对象。


作者(S)----------Author(s)----------


Jianhua Zhang



参考文献----------References----------

<h3>See Also</h3>

举例----------Examples----------


# Create an R environment to store the values of primary widgets[创建R环境的主要部件的存储值]
PWEnv <- new.env(hash = TRUE, parent = parent.frame(1))

# Create a label[创建一个标签]
label1 <- label(wName = "label1", wValue = "File Name: ", wEnv = PWEnv)

# Create an entry box with "Feed me using brows" as the default value[创建一个输入框,“喂我用眉毛”作为默认值]
entry1 <- entryBox(wName = "entry1", wValue = "Feed me using browse",
                   wEnv = PWEnv)

# Create a button that will call the function browse2Entry1 when[创建一个按钮,将调用函数browse2Entry1]
# pressed.[按下。]
browse2Entry1 <- function(){
    tempValue <- tclvalue(tkgetOpenFile())
    temp <- get(wName(entry1), env = PWEnv)
    wValue(temp) <- paste(tempValue, sep = "", collapse = ";")
    assign(wName(entry1), temp, env = PWEnv)
}
button1 <- button(wName = "button1", wValue = "Browse",
                     wFuns = list(command = browse2Entry1), wEnv = PWEnv)

# Create a list box with "Option1", "Option2", and "Option3" as the[创建一个列表框“选项1”,“选择2”,作为“选项3”]
# content and "Option1" selected[内容和“选项1”的选择]
list1 <- listBox(wName = "list1", wValue = c(Option1 = TRUE, Option2 = FALSE,
                                 Option3 = FALSE), wEnv = PWEnv)

# Create a text box with "Feed me something" displayed[创建一个文本框:“你喂养我的东西”,显示]
text1 <- textBox(wName = "text1", wValue = "Feed me something",
                 wEnv = PWEnv)

# Create a set of radio buttons with "radio1" as the default[创建一组单选按钮,“收音机1”作为默认]
label2 <- label(wName = "label2", wValue = "Select one:  ", wEnv = PWEnv)
radios1 <- radioButton(wName = "radios1", wValue = c(radio1 = TRUE,
                       radio2 = FALSE, radio3 = FALSE), wEnv = PWEnv)

# Create a set of check boxes with "check1" selected and "check2" and[创建一个集检查箱“CHECK1”的选择和“CHECK2”]
# "check3" not selected[“check3”没有选择]
label3 <- label(wName = "label3", wValue = "Select one to many: ",
wEnv = PWEnv)
checks1 <- checkButton(wName = "checks1", wValue = c(check1 = TRUE,
                       check22 = FALSE, check3 = FALSE), wEnv = PWEnv)

# Please not that the name of the primary widget object (e.g. checks1)[请不要的主要部件对象的名称(如checks1)]
# should be the same as the value of the name slot of the object[应该为对象的名称槽值相同]
# (e. g. name = "checks1")[(E.克。名称=“checks1”)]

# Render the widgets[渲染的部件]
pWidgets <- list(topRow = list(label1 = label1, entry1 = entry1,
                 button1 = button1), textRow = list(list1 = list1,
                 text1 = text1), radGroup = list(label2 = label2,
                 radios1 = radios1), chkGroup = list(label3 = label3,
                                     checks1 = checks1))
## Not run: [#无法运行:]
## These cannot be run by examples() but should be OK when pasted[#这些不能运行的例子(),但粘贴时,应确定]
## into an interactive R session with the widgetTools package loaded[#进入与互动R会话的widgetTools装载包]

aWidget <- widget(wTitle = "A test widget", pWidgets, funs = list(),
                 preFun = function() print("Hello"),
                 postFun = function() print("Bye"), env = PWEnv)

## End(Not run) [#结束(不运行)]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-22 19:08 , Processed in 0.035127 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表