tk2ico.create | R Documentation |
Create, load and work with Windows icons. Change icons for Windows. These
functions are only useful for Windows, but they silently return NULL
on
other platforms for writing compatible code (Windows icons instructions can
be simply ignored).
tk2ico.create(iconfile, res = 0, size = 16)
tk2ico.destroy(icon)
tk2ico.list(file = "shell32.dll")
tk2ico.sizes(file = "shell32.dll", res = "application")
tk2ico.load(file = "shell32.dll", res = "application", size = 16)
tk2ico.setFromFile(win, iconfile)
tk2ico.set(win, icon)
iconfile |
A file with a .ico, or .exe extension, containing one or more Windows icons |
res |
The name of the resource from where the icon should be extracted. |
size |
Te size of the icon to use. For windows icons, 16 should be fine usually. |
icon |
A icon object. |
file |
A file having icon resources (.exe, or .dll). |
win |
A Tk window, or an integer representing the handle (HWND) of a
foreign window whose icon will be changed (take care, the function returns
|
An icon object, which is a reference to an image resource in Tcl. Its classes
are c("tclObj", "tclIcon")
. Do not forget to destroy it using
tk2ico.destroy()
when you do not need it any more!
If tk2ico.load()
fails, it returns NULL
instead of a Tcl object.
This is Windows-specific. It is implemented using the ico Tcl package.
Philippe Grosjean
tk2dde.exec()
, tk2reg.get()
## Not run:
# These cannot be run by examples() but should be OK when pasted
# into an interactive R session with the tcltk package loaded
### Examples of tk2ico - icon manipulation under Windows
tt2 <- tktoplevel()
# Load a system icon (there are: "application", "asterisk", "error",
# "exclamation", "hand", "question", "information", "warning", and "winlogo".
Warn <- tk2ico.load(res = "warning")
# Change the icon of my window tt2
tk2ico.set(tt2, Warn)
# Do not forget to destroy icon to free resource when not needed any more
tk2ico.destroy(Warn)
rm(Warn)
### Otherwise, the list of icons in a file are:
tk2ico.list()
# and for a given icon, the various sizes are:
tk2ico.sizes(res = 4)
### One can set icon of a window from an .ico or .exe file directly
tk2ico.setFromFile(tt, default = file.path(R.home("bin"), "Rgui.exe"))
tk2ico.setFromFile(tt2, system.file("gui", "SciViews.ico", package = "tcltk2"))
### When done, dispose of the window and clean the workspace
tkdestroy(tt2)
rm(tt2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.