The macros toolbar has buttons that calls the Tcl code. Most buttons and procs are predefined, for common use, but each user can add its own buttons (they are stored with his preferences) to do some interesting actions.
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, …