Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Perl/Tk problems with PNG transparence

by zentara (Archbishop)
on Jul 30, 2014 at 13:03 UTC ( [id://1095611]=note: print w/replies, xml ) Need Help??


in reply to Perl/Tk problems with PNG transparence

Tk itself, does not support transparency, but Tk::Zinc does. Another alternative is to move up to Gtk2 or Gtk3, which does handle transparency. For example see: Goo Canvas and transparent images
#!/usr/bin/perl use warnings; use strict; use Tk::Zinc; my $width = 100; my $height = 100; my $mw = MainWindow->new(-background => 'cyan'); $mw->geometry($width.'x'.$height.'+300+300'); $mw->overrideredirect(1); my $zinc = $mw->Zinc(-width => $width, -height => $height, -reshape => 1, #clips zinc -fullreshape => 1, #clips $mw and xterm -backcolor => 'cyan', )->pack; #make a flower my $petal = $zinc->add('curve',1,[[$width/2,$height], [0,0, 'c'], [$width,0, 'c'], [$width/2,$height]], -tags => ['bezier1'], -filled => 1, -fillcolor => 'cyan', -closed => 1, -linewidth => 0, -priority => 1, -visible => 0, ); # using the triangulaire curve to reshape both TkZinc and Mainwindow w +idgets $zinc->itemconfigure(1, -clip => $petal); my $petal1 = $zinc->add('curve',1,[[$width/2,$height], [-2*$width,-100 +, 'c'], [3*$width,-100, 'c'], [$width/2,$hei +ght]], -tags => ['bezier1'], -filled => 1, -fillcolor => 'cyan', -closed => 1, -linewidth => 0, -priority => 1, -visible => 1, ); &Tk::MainLoop;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Perl/Tk problems with PNG transparence
by wmfs (Acolyte) on Jul 30, 2014 at 15:36 UTC
    Boy! That was quick! Unfortunately I'm having problems locating Tk::Zinc. It's not showing on PPM under ActivePerl, and CPAN Tk::Zinc doesn;t appear to find it either. The CPAN website lists http://www.tkzinc.org/ or http://freshmeat.net/projects/zincisnotcanvas/ as possible sources, but the first looks duff to me, and downloading from the second reports 'file not found'. Anyone know where I can find Tk::Zinc, please?

      I don't have ActivePerl or Tk modules installed on my system, but using the CPAN shell, I was able to download Tk::Zinc without any issues. Are you sure that you have cpan configured properly for you network (such as web/ftp proxies)?

      Also, if you use your web browser to go to Tk::Zinc, you can download the tarball to manually install it. Look for the link for tk-zinc-3.303.tar.gz in the upper right hand portion of the screen. Keep in mind that if you plan to download and manually install this module, you'll have to manually take care of any needed dependencies too.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1095611]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found