UI Class

From TouchDesigner Documentation
Jump to: navigation, search

The UI class describes access to the UI elements of the application, found in the automatically imported td module.

To access members and methods of this class use the default instance ui.

For Example:

# open the Midi Device Mapper Dialog


clipboardstr :

Get or set the operating system clipboard text contents.

colorstd.Colors (Read Only):

Access to the application colors.

dpiBiCubicFilterbool :

Get or set the global DPI scale filtering mode of TouchDesigner windows. True means bi-cubic, False means linear.

masterVolumefloat :

Get or set the master audio output volume. A value of 0 is no output, while a value of 1 is full output.

optionstd.Options (Read Only):

Access to the application options.

panestd.Panes (Read Only):

Access to the set of all panes.

performModebool :

Get or set Perform Mode. Set to True to go into Perform Mode, False to go into Designer Mode.

preferencestd.Preferences (Read Only):

Access to the application preferences, which can also be access through the Preferences Dialog.

redrawMainWindowbool :

Get or set whether the main window should redraw. The main window is either the main network editor, or the perform window.

rolloverOpOP (Read Only):

Operator currently under the mouse in a network editor.

rolloverPartd.Par (Read Only):

Parameter currently under the mouse in a parameter dialog.

lastChopChannelSelectedtd.Par (Read Only):

Last CHOP channel selected via mouse.

showPaletteBrowserbool :

Get or set display of the palette browser.

statusstr :

Get or set the status message.

ui.status = 'Operation Complete'

undotd.Undo (Read Only):

Acess to application undo functions.

windowWidthint (Read Only):

Get the app window width.

windowHeightint (Read Only):

Get the app window height.

windowXint (Read Only):

Get the app window X position.

windowYint (Read Only):

Get the app window Y position.



Copy a list of operators to the operator clipboard. All operators must be children of the same component.

  • listOfOPs - A list containing one or more OPs to be copied.
ui.copyOPs( op('geo1').selected )

pasteOPs(COMP, x=None, y=None)None:

Copy the contents of the operator clipboard into the specified component.

  • COMP - The destination to receive the operators.
  • x - Optional network coordinates at which to paste the operators.
  • y - see x
l = ui.pasteOPs( op('geo2') )

messageBox(title, message, buttons=['Ok'])int:

This method will open a message dialog box with the specified message. Returns the index of the button clicked.

  • title - Specifies the window title.
  • message - Specifies the content of the dialog.
  • buttons - (Keyword, Optional) Specifies a list button labels to show in the dialog.
# basic usage
ui.messageBox('Warning', 'Have a nice day.')
# specify options and report result
a = ui.messageBox('Please select:', 'Buttons:', buttons=['a', 'b', 'c'])
ui.messageBox('Results', 'You selected item: ' + str(a))
# pick a node from their paths
ui.messageBox('Please select:', 'Nodes:', buttons=parent().children)
# pick a node from their first names (list comprehension)
ui.messageBox('Please select:', 'Nodes:', buttons=[x.name for x in parent().children])
# pick a cell
ui.messageBox('Please select:', 'Cells:', buttons=op('table1').cells('*','*'))


Update and redraw all viewports, nodes, UI elements etc immediately. This update is otherwise done once per frame at the end of all script executions. For example, if the current frame is manually changed during a script, a call to refresh will cause all dependent data to update immediately.

for i in range(100):
	ui.status = str(i)

chooseFile(load=True, start=None, fileTypes=None, title=None, asExpression=False)str or None:

Open a dialog box for loading or saving a file. Returns the filename selected or None if the dialog is cancelled.

  • load - (Keyword, Optional) If set to True, the dialog will be a Load dialog, otherwise it's a Save dialog.
  • start - (Keyword, Optional) If provided, specifies an initial folder location and/or filename selection.
  • fileTypes - (Keyword, Optional) If provided, specifies a list of file extensions that can be used as filters. Otherwise '*.*' is the only filter.
  • asExpression - (Keyword, Optional) If set to true, the results are provided as an expression, suitable for a Parameter expression or as input to an eval() call. App Class member constants such as samplesFolder may be included in the result.
  • title (Keyword, Optional) If provided, will override the default window title.
a = ui.chooseFile(start='python_examples.toe', fileTypes=['toe'], title='Select a toe') # specify extension
a = ui.chooseFile(fileTypes=tdu.fileTypes['image'], title='Select an image') # any support image extension
path = ui.chooseFile(load=False,fileTypes=['txt'],title='Save table as:')
if (path):

chooseFolder(title='Select Folder', start=None, asExpression=False)str or None:

Open a dialog box for selecting a folder. Returns the folder selected or None if the dialog is cancelled.

  • title - (Keyword, Optional) If provided, specifies the window title.
  • start - (Keyword, Optional) If provided, specifies an initial folder location and/or filename selection.
  • asExpression - (Keyword, Optional) If set to true, the results are provided as an expression, suitable for a Parameter expression or as input to an eval() call. App Class member constants such as samplesFolder may be included in the result.
a = ui.chooseFolder()
a = ui.chooseFolder(title='Select a folder location.')


View a url or file in the default external application.

  • url_or_path - url or path to launch.
a = ui.viewFile('output.txt')


Deprecated. Use TDAbleton instead.


Open the Beat Dialog.


Open the Bookmarks Dialog.


Open component editor for the specific operator.

  • path - Specifies the path to the operator. An OP can be passed in as well.


Open the Console Window.


Open help page for the specific dialog.

  • title - Specifies the help page to open.
ui.openDialogHelp('Window Placement Dialog')


Open the Errors Dialog.


Open an Explorer window.


Open the Export Movie Dialog.

  • path - Specifies the operator content to export.


Open the Help Dialog.


Open the Import File Dialog.


Open the Key Manager Dialog.


Open the MIDI Device Mapper Dialog.


Open the New Project Dialog.

openOperatorSnippets(family=None, type=None, example=None)None:

Open the Operator Snippets window.


Open the Palette.


Open the Performance Monitor Dialog.


Open the Preferences Dialog.


Open the Search Dialog.


Open the Textport.


Open a dialog displaying current version information. See also: App.version


Open the Window Placement Dialog.

TouchDesigner Build:

Any floating window that is not a Pane or Viewer.

Mode where the network editing window is not open, your performance interface window(s) is open and you are running your application as fast as possible. See Designer Mode.

Any of the procedural data operators. OPs do all the work in TouchDesigner. They "cook" and output data to other OPs, which ultimately result in new images, data and audio being generated. See Node.

An Operator Family that contains its own Network inside. There are twelve 3D Object Component and eight 2D Panel Component types. See also Network Path.

TOuch Environment file, the file type used by TouchDesigner to save your project.

The operating system's holder of files and other folders (directories). It does not refer to operators within TouchDesigner. See Network Path.

Strictly refers to a window in Microsoft Windows. User-created windows are made with Panels inside Window Components, aside from the TouchDesigner editor window and its dialogs.

OP Snippets is a set of numerous examples of TouchDesigner operators, which you access via the Help menu. These can be copied/pasted into your projects.