Personal tools
You are here: Home documentation GUI Plugins GuiPluginsAPI
Views

Starting with 0.43, Pd provides a number of ways to hook your code in to make the GUI behave how you want. There isn't a separate API for the GUI plugins, instead you can think of all of Pd's Tcl side as the API for GUI Plugins. Certain things in pd-gui were tailored for GUI plugins, for that you can get an idea of what is available by reading through pd-gui.tcl, more specifically at the global variables and procs that can be hooked into.

This is just a quick overview of what's available, check out the Pd sources for more info, especially pd-gui.tcl and pdtk_canvas.tcl.

events for getting info

If you want to trigger something based on a state change, the best way is to bind to a virtual event

<<EditMode>>

Edit Mode has changed for the %W window

<<Loading>>

the patch marked by %Whas started loading

<<Loaded>>

the patch marked by %Whas finished loading

arrays for per-patch properties

These arrays all use $mytoplevel window (aka the .x%lx canvas ID) for the keys.

::loaded

boolean that is set to 0 when the patch starts loading, then set to 1 once the patch is finished loading

::editmode

boolean for the state of editmode

::editingtext

boolean for whether a text box (obj, msg, or text) is being edited

classes of windows

DialogWindow

any dialog window, like Find, iemgui, Font, etc.

PatchWindow

the window of a patch's Tk canvas

PdWindow

this class only applies to the Pd window itself

tags for types of graphical elements

Tk allows you to tag every item with multiple tags, and each item drawn in Pd is tagged with one or more tags. The easiest of these to use are the standard tags for the various logical elements:

  • obj - a regular, non-graphical object box

  • msg - a message box

  • cord - a cord, both signal and message

  • inlet - an inlet, both signal and message

  • outlet - an outlet, both signal and message

  • atom - a float or symbol atom box

  • text - a text comment

  • label - synonym for text

  • scalar - a graphical scalar element

  • graph - a graph for displaying an array

  • GOP - the Graph-on-Parent box that marks the visual area on a canvas

global variables for setting colors

As of Pd-extended 0.41, there is a set of global variables for setting the colors of a number of essential elements of Pd, anything from the background color, box outline and fill, cords, text, etc.

set ::canvas_fill "white"
set ::text_color "#000"
set ::select_color "#00f"
set ::dash_outline "#f00"
set ::dash_fill "#fff"
set ::box_outline "#ccc"
set ::graph_outline "#777"
set ::atom_box_fill "#eee"
set ::msg_box_fill "#f8f8f6"
set ::obj_box_fill "#f6f8f8"
set ::signal_cord_highlight "#58a"
set ::signal_cord "#558"
set ::signal_nlet $signal_cord
set ::msg_cord_highlight "#474"
set ::msg_cord "#121"
set ::msg_nlet "#fff"
set :mixed_nlet "#88aaff"

plugins in SVN

There are many plugins available in the pure-data SVN:

svn co https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/scripts/guiplugins
svn co https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/guiplugins

There are also some elaborate plugins in the pd-gui-rewrite SVN. You can download them via the web interface, or using SVN (look in the disabled folder too):

svn co https://pure-data.svn.sourceforge.net/svnroot/pure-data/branches/pd-gui-rewrite/0.43/startup/



Powered by IEM Powered by Plone Section 508 WCAG Valid XHTML Valid CSS Usable in any browser