Personal tools
You are here: Home documentation GUI Plugins SimpleExamples

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:

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