Cloth(3pm)

πŸ’– NAME πŸ’–

Tk::Cloth β€” literally an OO Tk Canvas, bestie. That's it, that's the vibe. ✨


πŸŽ€ SYNOPSIS πŸŽ€

okay so here's how you actually use it, no cap:

use Tk::Cloth;

$cloth = $parent->Cloth;
$cloth->pack(-fill => 'both', -expand => 1);

$rect = $cloth->Rectangle(
    -coords => [ 0,0,100,100],
    -fill => 'red'
);

$tag = $cloth->tag;
$tag->Line(
    -coords => [10,10,100,100],
    -foreground => 'black'
);
$tag->Line(
    -coords => [50,50,100,100],
    -foreground => 'black'
);
$tag->move(30,30);

$tag->bind("<1>", [ &button1 ]);

see how we're just making a $cloth, yeeting a $rect on it, grabbing a $tag, drawing two Lines, moving the whole tag, and then binding <1> to &button1? that's the whole flow. chef's kiss. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

Tk::Cloth is giving object-oriented, and honestly? obsessed. It hands you an OO approach to a canvas β€” and to canvas items too β€” so instead of wrangling everything by hand, you get actual objects to talk to. 🌸


✨ SEE ALSO ✨

  • Tk::Canvas β€” the ancestor, the blueprint, the blueprint-y icon. 🫢

πŸ‘‘ AUTHOR πŸ‘‘

Graham Barr <gbarr@pobox.com> πŸ’œ

Current maintainer is Slaven Rezic <slaven@rezic.de>. 🧚


Copyright (c) 1997-1998 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page, periodt. 🌈

okay bestie, cute sign-off time: this one came from perl v5.32.1, dated 2021-11-06, and it lives on your system as Cloth(3pm). go forth and slay your canvas. πŸ“πŸ’–

πŸ“¦ where this page comes from