This probably only works on linux, and only if your window manager supports clipping. FVWM2 does. Anyways, with Zinc you can clip the xterm and make it transparent, giving us the ability to make exotic shaped displays. To demonstrate this, I made a little UFO which will fly around your screen. Of course, various controls could be put on this canvas, to give a cooler look. Why be "square"?

Comment out the "reshape" and "fullrehape" lines to see the clipping control.

#!/usr/bin/perl use warnings; use strict; use Tk::Zinc; my $width = 200; my $height = 100; my $xpos = -10; my $ypos = -10; my $mw = MainWindow->new(-background => 'cyan'); $mw->geometry($width.'x'.$height.$xpos.$ypos); $mw->overrideredirect(1); my $zinc = $mw->Zinc(-width => $width, -height => $height, -reshape => 1, #clips zinc -fullreshape => 1, #clips $mw and xterm -backcolor => 'cyan', )->pack; my $ufo = $zinc->add('curve',1,[[$width/2,0], [2*$width,0, 'c'], [2*$width,$height, 'c'], [$width/2,$height], [-$width,$height, 'c'], [-$width,0, 'c'], [$width/2,0]], -tags => ['bezier1'], -closed => 1, -visible => 0, ); my @portholes; for(0..8){ my $porthole = $zinc->add('arc', 1, [10+20*$_,40,20+20*$_,50], -filled => 1, -fillcolor => 'white', -visible => 1); push(@portholes,$porthole); } $mw->bind("<Button 1>",sub{Tk::exit}); # using the curve to reshape both TkZinc and Mainwindow widgets $zinc->itemconfigure(1, -clip => $ufo); my $dx = 0 ; my $dy = -1; $mw->repeat(10,sub { $xpos = $xpos + $dx; $ypos = $ypos + $dy; if(400 + $ypos < 0){$dy = 1; $dx = -1} if(-$ypos < 10){$dx = 1; $dy = 0} if($xpos == 0){$xpos = -10;$ypos = -10; $dx = 0;$d +y=-1} $mw->geometry($width.'x'.$height.$xpos.$ypos); $mw->update; }); &Tk::MainLoop;

In reply to UFO: Oval xterm with Tk::Zinc by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.