tk2dialogfonts: Additional Tk dialog boxes

tk2chooseFontR Documentation

Additional Tk dialog boxes

Description

Tk dialog boxes to select a font, unicode characters or a list of ordered items.

Usage

tk2chooseFont(...)

tk2unicode_config(parent)

tk2unicode_select(widget)

tk2unicode_bind(widget)

Arguments

...

Further arguments passed to the dialog box.

parent

The Tk toplevel dialog box that will be the parent of the configuration dialog box.

widget

A widget that can accept a unicode character. For tk2unicode_bind() it must be a tk2text or a tk2entry widget.

Value

The selection made in the dialog box if OK is clicked, "" otherwise for tk2chooseFont().

The tk2unicode_select() dialog pastes the selected unicode character in the designed widget, but returns nothing. The tk2unicode_config() changes the configuration for the unicode composer, but returns nothing. If you decide to do so, it saves the config on a file. This is done app-by-app, and the default app name is "R". You can change it by setting a different value in the option "tk2app", i.e., options(tk2app = "myApp"). The tk2unicode_bind() is also invoked for its side-effect to install required bindings to enable the unicode composer engine for the given widget and it returns nothing.

Author(s)

Philippe Grosjean

See Also

tk2text(), tk2listbox(), tk2list.insert()

Examples

## Not run: 
library(tcltk2)
# These cannot be run by examples() but should be OK when pasted
# into an interactive R session with the tcltk package loaded

# Font selection
tk2chooseFont()
tk2chooseFont(font = "{courier} 9", title = "Choose a fixed font",
  fonttype = "fixed", style = 4, sizetype = "all")
tk2chooseFont(font = "Verdana 12 bold italic underline overstrike",
  fonttype = "prop", style = 2, sizetype = "point")

# Easy unicode character entry
tt <- tktoplevel()
txt <- tk2text(tt, width = 60, height = 20)
tkpack(txt)
e <- tk2entry(tt, width = 50)
tkpack(e)
# Get an unicode character for the text widget
tk2unicode_select(txt)
# and for the entry widget
tk2unicode_select(e)

# Bind the composer to both the text and the entry widgets
# and display the configuration box
# Once done, try the compose key + m + u, or compose + " + a
# or any othert sequence in both widgets
# or hit the compose key twice
tk2unicode_bind(txt)
tk2unicode_bind(e)
tk2unicode_config(tt)

## End(Not run)

tcltk2 documentation built on June 8, 2025, 1:04 p.m.