1Tk_Init(3)                   Tk Library Procedures                  Tk_Init(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tk_Init,  Tk_SafeInit  -  add  Tk  to  an interpreter and make a new Tk
9       application.
10

SYNOPSIS

12       #include <tk.h>
13
14       int
15       Tk_Init(interp)
16
17       int
18       Tk_SafeInit(interp)
19

ARGUMENTS

21       Tcl_Interp *interp (in)                   Interpreter in which to  load
22                                                 Tk.  Tk should not already be
23                                                 loaded in this interpreter.
24______________________________________________________________________________
25

DESCRIPTION

27       Tk_Init is the package initialization procedure for Tk.  It is normally
28       invoked  by the Tcl_AppInit procedure for an application or by the load
29       command.  Tk_Init adds all of Tk's commands to interp and creates a new
30       Tk  application,  including  its main window.  If the initialization is
31       successful Tk_Init returns TCL_OK;  if there is  an  error  it  returns
32       TCL_ERROR.   Tk_Init  also  leaves  a result or error message in inter‐
33       preter interp's result.
34
35       If there is a variable argv in interp, Tk_Init treats the  contents  of
36       this  variable  as  a  list of options for the new Tk application.  The
37       options may have any of the forms documented for the  wish  application
38       (in fact, wish uses Tk_Init to process its command-line arguments).
39
40       Tk_SafeInit  is identical to Tk_Init except that it removes all Tk com‐
41       mands that are considered unsafe.  Those commands and the  reasons  for
42       their exclusion are:
43
44       bell   Continuous ringing of the bell is a nuisance.
45
46       clipboard
47              A  malicious  script could replace the contents of the clipboard
48              with the string “rm -r *” and lead to surprises  when  the  con‐
49              tents of the clipboard are pasted.
50
51       grab   Grab can be used to block the user from using any other applica‐
52              tions.
53
54       menu   Menus can be used to cover the entire screen and to steal  input
55              from the user.
56
57       selection
58              See clipboard.
59
60       send   Send  can  be  used to cause unsafe interpreters to execute com‐
61              mands.
62
63       tk     The tk command recreates the send command, which is unsafe.
64
65       tkwait Tkwait can block the containing process forever
66
67       toplevel
68              Toplevels can be used to cover the entire screen  and  to  steal
69              input from the user.
70
71       wm     If  toplevels are ever allowed, wm can be used to remove decora‐
72              tions, move windows around, etc.
73

KEYWORDS

75       safe, application, initialization, load, main window
76
77
78
79Tk                                    8.0                           Tk_Init(3)
Impressum