The macros toolbar have buttons that call the Tcl code. Most buttons and procs are predefined, for common use, but each user can add its own buttons (they are stored with its preferences), to do some interesting action.
See Macros
In particular the Tcl code can invoke Python code with the procs related previously: GiD_Python_Exec, GiD_Python_Call, GiD_Python_Source, …