A menubutton widget displays a textual label and/or image, and displays a menu when pressed.
tic_menubutton(..., text, bind = NULL, pack = NULL)Other arguments are parsed as follows:
named argumentsFurther options to be used during the creation of this widget. See the tcl/tk documentation for all arguments possible for this widget.
unnamed argumentsContainer widgets (e.g. tic_frame()) treat any
unnamed arguments as child objects. Non-container widgets
(e.g tic_button()) will
raise an error if there are any unnamed widgets.
Specifies a text string to be displayed inside the widget.
textSimple character string containing the name
textvariableReactive variable containing a string
bind commands to particular events on this element. This may be
a single result of bind_opts() or a list of them for multiple
events.
how this object should be packed into its parent. pack has
no effect for tic_menu() or tic_menu_item().
handle on the tcl/tk object
Include items in this menu using tic_menuitem() and tic_submenu()
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_menubutton.htm
Other widgets:
tic_button(),
tic_canvas(),
tic_checkbutton(),
tic_combobox(),
tic_label(),
tic_menuitem(),
tic_menu(),
tic_progressbar(),
tic_radiobutton(),
tic_separator(),
tic_sizegrip(),
tic_slider(),
tic_spinbox(),
tic_submenu(),
tic_textbox(),
tic_textentry()
tic_menubutton(
text = "Press for menu",
tic_menuitem("Run a command", menutype = "command", command = function() {
message("This is where a command is run")
}),
tic_submenu(
label = "Sub menu here",
tic_menuitem("Run this", "command", command = function() { message("Hello")})
)
)
#> List of 5
#> $ args :List of 1
#> ..$ text: chr "Press for menu"
#> $ type : chr "menubutton"
#> $ children:List of 2
#> ..$ :List of 6
#> .. ..$ args :List of 3
#> .. .. ..$ label : chr "Run a command"
#> .. .. ..$ command :function ()
#> .. .. .. ..- attr(*, "srcref")= 'srcref' int [1:8] 3 65 5 3 65 3 3 5
#> .. .. .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x7f996be66710>
#> .. .. ..$ background: chr "white"
#> .. ..$ type : chr "menuitem"
#> .. ..$ menutype: chr "command"
#> .. ..$ children: list()
#> .. ..$ binding : NULL
#> .. ..$ pack : NULL
#> ..$ :List of 6
#> .. ..$ args :List of 2
#> .. .. ..$ tearoff : logi FALSE
#> .. .. ..$ background: chr "white"
#> .. ..$ type : chr "submenu"
#> .. ..$ children:List of 1
#> .. .. ..$ :List of 6
#> .. .. .. ..$ args :List of 3
#> .. .. .. .. ..$ label : chr "Run this"
#> .. .. .. .. ..$ command :function ()
#> .. .. .. .. .. ..- attr(*, "srcref")= 'srcref' int [1:8] 8 51 8 80 51 80 8 8
#> .. .. .. .. .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x7f996be66710>
#> .. .. .. .. ..$ background: chr "white"
#> .. .. .. ..$ type : chr "menuitem"
#> .. .. .. ..$ menutype: chr "command"
#> .. .. .. ..$ children: list()
#> .. .. .. ..$ binding : NULL
#> .. .. .. ..$ pack : NULL
#> .. ..$ binding : NULL
#> .. ..$ label : chr "Sub menu here"
#> .. ..$ pack : NULL
#> $ binding : NULL
#> $ pack : NULL