Create a Custom GUI Button - 2022.2 English

Vivado Design Suite User Guide: Using Tcl Scripting (UG894)

Document ID
UG894
Release Date
2022-10-19
Version
2022.2 English

A custom button is created using the create_gui_custom_command command.

The syntax is:

create_gui_custom_command -name <arg> [-menu_name <arg>] [-description <arg>]
                           [-show_on_toolbar] [-run_proc <arg>]
                           [-toolbar_icon <arg>] [-command <arg>]
                           [-tcl_file <arg>] [-quiet] [-verbose]
Usage: 
  Name        Description
  -------------------------------
  -name        Unique name of the command to create.
  [-menu_name]    Menu name for the custom command.
  [-description]   Display this text for the description of the menu item 
                      and optionally the toolbar button
  [-show_on_toolbar] Add this command to the toolbar
  [-run_proc]     Needed when '-command' and 'tcl_file' options are both 
                      specified.
                      If true, gui button will run command mentioned in 
                      '-command' option otherwise source script mentioned in 
                      '-tcl_file' option
  [-toolbar_icon]   The full path to the PNG or JPEG file to display on the
                      toolbar button
  [-command]     The command to execute
  [-tcl_file]     The full path to the Tcl file to source
  [-quiet]      Ignore command errors
  [-verbose]     Suspend message limits during command execution

The name specified using -name must be unique among all the custom buttons and should not contain any spaces. This name is used to add arguments to the button.

Example 1: Create a custom button calling the proc, myProc:

create_gui_custom_command -name "myButton" \
-menu_name "Do something" \
-command "myProc" \
-show_on_toolbar \
-run_proc true

Example 2: Create a custom button to print inside the Tcl console the clock(s) propagating through the selected object(s):

create_gui_custom_command -name "getClock" \
-menu_name "get_clock" \
-command {get_clocks -of [get_selected_objects]} \
-description {This button returns the clocks going through the selected objects} \
-show_on_toolbar