Version 16 of Shape

Updated 2012-10-09 16:36:14 by Jorge

Extension written by Donal Fellows which allows arbitrarily shaped windows on X11 and Windows to be created. MacOS and MacOS X are not yet supported (but you can paint the appropriate areas with a transparent colour in Tk 8.5, and it should work anyway).

http://www.man.ac.uk/~zzcgudf/tcl/#scripts/shape

This is getting very interesting as it "homes in" on full cross-platform functioning. I found no instructions for building the Windows version. I suppose it blindingly obvious, but could you drop a few hints for us extension building neophytes? Or even post a dll? - Roy Terry, 6Dec2003

TkTrans is a Windows-specific alternative.


Something like Shape needs to be combined with a 'drag and drop' extension to allow proper dragging of arbitrarily shaped objects from, e.g. a canvas or a text widget (where you might want to drag a non-rectangular block of text).

Does anyone have plans to really add proper 'drag and drop' support to Tk? Any TIPs in the pipeline?

MGS 2003/03/26 - I think the best bet may be TkDND

DKF: 27-Mar-2003 - It's on the Tk 9.0 Wishlist.


The extension appears to have moved to:

http://www.cs.man.ac.uk/~fellowsd/tcl/shapeidx.html


In a discussion on comp.lang.tcl it is shown that you can get a shaped window even with plain Tcl on windows. However I would only use it for a splash screen.

wm overrideredirect [toplevel .some] 1
wm geometry  .some 800x600+40+20
wm attribute .some -transparentcolor #C1C2C3
canvas .some.c -wid 800 -hei 600 -bg #C1C2C3 \
-bd 0 -relief flat -highlightthickness 0
pack .some.c -padx 0 -pady 0 -ipadx 0 -ipady 0
.some.c create oval 20 20 780 580 -width 1 -fill #ff0000
frame .some.c.w
pack [label .some.c.w.t -text "Bonjour! Tcl" -fg #C1C2C3]
.some.c create window 40 40 -window .some.c.w

RLE (2012-10-08): Note that the "-transparentcolor" option to wm attribute is documented as a Windows only feature (wm man page):

On Windows, the following attributes may be set.
...
-transparentcolor
Specifies the transparent color index of the toplevel. ...

tcltk-d: 2012-10-09 On MacOS10.6 wish V8.4

 # (set w .anytoplevel)
 $w conf -bg systemTransparent
 wm attribute $w -transparent 1

may work!.