Anda di halaman 1dari 2


last edited 8 years ago by hans

Document Actions

Send this page to somebody Print this page

It is possible to do very useful things in a few lines of code in a GUI plugin. Here are a couple of quick
examples of plugins. It is also possible to develop quite elaborate plugins.

Enable The VU Meters By Default

The Pd window's VU meters are off by default, this plugin makes them on by default.

set ::meters 1

pdsend "pd meters 1"

Set Custom Histories

The Find Dialog Panel and the Message Dialog Panel both have command histories that are accessible
using the Up/Down arrow keys. You can set your own custom history that will be loaded dy default.

set ::pdwindow::tclentry_history {"menu_message_dialog" "console hide" "console show"}

set ::dialog_message::message_history {"pd dsp 1" "pd dsp 0" "my very custom message"}

Triple-Click To Create Object

This is a sketch to demonstrate a Tcl "plugin" for Pd: it binds to triple-clicks to trigger the creation of a
new object. Only a patch window should have an entry in the ::editmode array.

proc process_tripleclick {window} {

set mytoplevel [winfo toplevel $window]

if {[winfo class $mytoplevel] == "PatchWindow" && $::editmode($mytoplevel)} {

::pd_connect::pdsend "$mytoplevel obj"


bind all <Triple-ButtonRelease-1> {process_tripleclick %W}

Only Show Cords In Edit Mode

This plugin uses the <<EditMode>> event to make it so the cords are only shown in edit mode, and other
hidden otherwise.

proc set_cords_by_editmode {mytoplevel} {

set mycanvas "$mytoplevel.c"

if { ! [winfo exists $mytoplevel] } {return}

if {$::editmode($mytoplevel) == 1} {

$mycanvas itemconfigure cord -fill black

$mycanvas raise cord

} else {

$mycanvas itemconfigure cord -fill white

$mycanvas lower cord

bind all <<EditMode>> {+set_cords_by_editmode %W}

Examples In Pure-Data SVN

You can see a bunch more examples, both simple and more elaborate in the pure-data SVN: