Python 3.4.1 installer on Mac links Python to old Tcl/Tk

Christian Gollwitzer auriocus at gmx.de
Thu Jun 26 08:37:12 EDT 2014


Am 26.06.14 12:39, schrieb Peter Tomcsanyi:
> "Christian Gollwitzer" <auriocus at gmx.de> wrote in message
> news:lofciv$nq6$1 at dont-email.me...
>> For PNG image support you can load either the Img package which gives
>> support for a large variety of images, or the smaller tkpng package.
>
> My first Google search for
> "tkpng" "python"
> gave no usable results. So I am not sure if and how can I use these Tk
> extensions from Python...

As I said, it doesn't have a special interface, you just load it and 
that's it. So if you do a tk.eval("package require tkpng"), your 
Tk.PhotoImage will magically recognize PNG. I don't know how widespread 
the installation is, but compilation is easy. An alternative is the 
widely available Img package, which adds support for many image formats 
like gif, bmp, jpeg, tga, tiff etc. On my Mac it came with the OS (I 
think); you'll do Tk.eval("package require Img"). Since there are no 
additional commands, it'll just work from Python as well. An alternative 
employed by Pythonistas is to load the image using PIL and create a Tk 
PhotoImage via the ImageTk bridge.

> And finally I want to show the picture(s) on a Tk-based Canvas on top of
> each other with properly handled semi-transparency.

This has been in the canvas for a long time, if you managed to create an 
image with an alpha channel.

> In our project we want to use as little as possible additonal packages
> because we expect that the end-users will use several platforms
> (Windows, Mac, Linux) and installing any extra Python-related package on
> non-Windows platform seems to be a nightmare, at least that is the
> result of the past three months of experience.

I understand.

> The need to go to the command line level for such a basic thing like
> installing or uninstalling something seems to me like going 20 to 30
> years back in history. We cannot expect that our end-users (especially
> the Mac-based ones) will have that expertise even if they have enough
> expertise to program in Python when it is finally correctly installed on
> their computers.

On the Mac you can create an APP bundle which contains everything, 
including extra dependencies. It is a folder with a special structure, 
you put it into a DMG archive and it matches the expectation a Mac user 
has of an "installer". Unfortunately these things are very 
system-dependent, and it's a lot of work to provide deployment (do 
program icons, setup file associations etc.)

>
>> For angled text it's right, I don't know, there used to be some hacks
>> before, it's probably not possible in a clean way.
>
> I was actually negatively surprised by the lack of this very basic
> feature (especially in a vector-graphics-based environment)

Yes this was a long-deferred feature due to its inhomogeneous 
implementation on the supported platforms. There were some extensions 
like 10 years ago to do it, but only in 8.6 (2012) it made it into the 
core Tk.

	Christian




More information about the Python-list mailing list