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

2014-10-05 Thread Ned Deily
In article ,
 Christian Gollwitzer  wrote:
[... much good stuff deleted ... ]
> wish is a type A program, it creates an interpreter and therefore must 
> link to the actual library. So is Tkinter. But Tkagg is not, it extends 
> a preexisting interpreter.

Thanks, Christian.  That's a good summary, I think.  After some more 
research, I agree with your conclusion that the stubs library approach 
does not apply to the case of embedding Tcl ("type A") which is what 
Python tkinter does.  As far as matplotlib or PIL/Pillow or other 
third-party packages that may extend Tck/Tk, it might be helpful to open 
an issue with suggested code on the various projects' issue trackers if 
someone cares to pursue this.

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-05 Thread Christian Gollwitzer

Am 04.10.14 07:53, schrieb Ned Deily:

In article ,
  Kevin Walzer  wrote:

A Tcl library compiled for 8.5 can be loaded into 8.6 with no
re-compiling required because of stubs.


It has nothing to do with Python per se; that's just the way linking
with OS frameworks work.


> [...]


When Python or other programs link with a framework, they use the cc or
ld -framework option, rather than -l:
 -framework Tcl -framework Tk

That causes the linker to look in the default search paths for
frameworks, /Library/Frameworks followed by /System/Library/Frameworks.
The install names of the framework shared libraries used are embedded in
the Mach-O file (executable, bundle, or shared library) produced by ld.
So the stub library archive is there but is not used, AFAIK.


Then it is done in a non-optimal way, though admittedly in the case of 
Tkinter, which is a hybrid Python/Tcl extension, the optimal way is not 
obvious. In the Tcl world, there are two different ways to link to Tcl 
(and analogously to Tk):


 A) you can link directly to libtcl.dylib (.so, .dll)

 B) you can define USE_TCL_STUBS during compilation and link to 
libtclstub.a


If you embed an interpreter, you must do A. So for Tkinter, linking 
directly to the dynamic lib (== -framework in OSX) is correct.


If you extend an interpreter by defining new commands, new Tcl_Obj, new 
Tk image types etc., you can do either A or B, but the recommended way 
is always B because this makes it possible to load an extension into any 
later interpreter than the one it was compiled against. The magic behind 
stubs are macros which replace function calls by invocations of an index 
into a function pointer table; that table is initialized at runtime, 
when the extension calls Tcl_InitStubs().


Now, tkagg is not loaded by the Tcl load() command. This means that 
after loading via Pythons import, the stub table should be initialized. 
Obviously this is not the case; if I'm not mistaken, just before this line


https://github.com/matplotlib/matplotlib/blob/master/src/_tkagg.cpp#L252

if you insert
Tcl_InitStubs(interp, TCL_VERSION, 0);
Tk_InitStubs(interp, TCL_VERSION, 0);

then it should be possible to compile tkagg with -DUSE_TCL_STUBS 
-DUSE_TK_STUBS, link to tclstub and tkstub and load the resulting tkagg 
into any Tkinter that links to an interpreter at least as new as 
TCL_VERSION. (If the result of either call is NULL, the interpreter is 
too old). Admittedly I'm too lazy to setup a build environment for 
matplotlib to try if this actually works.




There may be other ways to do it but that's how Python has always linked
to Tcl and Tk.  FWIW, that's how both Apple's and ActiveState's wish
executables are linked as well:


wish is a type A program, it creates an interpreter and therefore must 
link to the actual library. So is Tkinter. But Tkagg is not, it extends 
a preexisting interpreter.


Christian


--
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-03 Thread Ned Deily
In article ,
 Kevin Walzer  wrote:
> On 10/3/14, 3:55 PM, Ned Deily wrote:
> > Even if there were no incompatibilities, on OS X with Tcl and Tk (and
> > other) frameworks, the version number is embedded in the path to the
> > shared library and the linker normally creates an absolute path at that.
> 
> Is this because Python lacks the concept of stubs?
> 
> A Tcl library compiled for 8.5 can be loaded into 8.6 with no 
> re-compiling required because of stubs.

It has nothing to do with Python per se; that's just the way linking 
with OS frameworks work.  Both Apple and ActiveState install their 
versions of Tcl and Tk as frameworks.  What gets installed and what the 
OS X compilers and linkers expect is something like this:

$ cd /Library/Frameworks/Tk.framework/Versions/8.5
$ ls -l
total 5720
drwxr-xr-x+ 3 root  wheel  272 Nov 24  2013 Headers
drwxr-xr-x+ 2 root  wheel  340 Nov 24  2013 PrivateHeaders
drwxr-xr-x+ 4 root  wheel  272 Nov 24  2013 Resources
-rw-r--r--+ 1 root  wheel  2905000 Oct 27  2013 Tk
-rw-r--r--+ 1 root  wheel12240 Oct 27  2013 libtkstub8.5.a
-rw-r--r--+ 1 root  wheel 4622 Oct 27  2013 tkConfig.sh
$ file Tk
Tk: Mach-O universal binary with 2 architectures
Tk (for architecture x86_64): Mach-O 64-bit dynamically linked shared 
library x86_64
Tk (for architecture i386):   Mach-O dynamically linked shared library 
i386
$ file libtkstub8.5.a
libtkstub8.5.a: Mach-O universal binary with 2 architectures
libtkstub8.5.a (for architecture x86_64): current ar archive random 
library
libtkstub8.5.a (for architecture i386):   current ar archive random 
library
$ otool -D Tk
Tk:
/Library/Frameworks/Tk.framework/Versions/8.5/Tk

When Python or other programs link with a framework, they use the cc or 
ld -framework option, rather than -l:
-framework Tcl -framework Tk

That causes the linker to look in the default search paths for 
frameworks, /Library/Frameworks followed by /System/Library/Frameworks.  
The install names of the framework shared libraries used are embedded in 
the Mach-O file (executable, bundle, or shared library) produced by ld.  
So the stub library archive is there but is not used, AFAIK.

There may be other ways to do it but that's how Python has always linked 
to Tcl and Tk.  FWIW, that's how both Apple's and ActiveState's wish 
executables are linked as well:

$ more /usr/local/bin/wish8.5
#!/bin/sh
"$(dirname 
$0)/../../../Library/Frameworks/Tk.framework/Versions/8.5/Resources/Wish.
app/Contents/MacOS/Wish" "$@"
$ otool -L 
/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Wish.app/Contents
/MacOS/Wish
/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Wish.app/Contents
/MacOS/Wish:
   /Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility 
version 8.5.0, current version 8.5.15)
   /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility 
version 8.5.0, current version 8.5.15)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 125.2.0)
   /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa 
(compatibility version 1.0.0, current version 15.0.0)
   /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon 
(compatibility version 2.0.0, current version 152.0.0)
   /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit 
(compatibility version 1.0.0, current version 275.0.0)
   /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current 
version 625.0.0)

There's more info about frameworks in various Apple developer docs and 
in the man pages for ld, otool, and install_name_tool.

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-03 Thread Kevin Walzer

On 10/3/14, 3:55 PM, Ned Deily wrote:

Even if there were no incompatibilities, on OS X with Tcl and Tk (and
other) frameworks, the version number is embedded in the path to the
shared library and the linker normally creates an absolute path at that.


Is this because Python lacks the concept of stubs?

A Tcl library compiled for 8.5 can be loaded into 8.6 with no 
re-compiling required because of stubs.

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-03 Thread Ned Deily
In article ,
 Christian Gollwitzer  wrote:
> Hmm, I'm not sure that the other projects would need an update. In Tcl 
> world, there is the concept of stub libraries, an extra level of 
> indirect linking provided by both the Tcl and Tk core. If the extensions 
> link to the stub library (the standard way), they can be loaded into any 
> later version of Tcl and do not directly depend on libtcl or libtk. If 
> the extensions link directly to libtcl, they are either broken or very 
> special (providing one's own interpreter, doing nasty stuff with 
> internals etc.)

Even if there were no incompatibilities, on OS X with Tcl and Tk (and 
other) frameworks, the version number is embedded in the path to the 
shared library and the linker normally creates an absolute path at that.

$ otool -L _tkagg.so
_tkagg.so:
   /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current 
version 60.0.0)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1197.1.1)
   /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility 
version 8.5.0, current version 8.5.15)
   /Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility 
version 8.5.0, current version 8.5.15)

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-03 Thread Christian Gollwitzer

Am 03.10.14 00:08, schrieb Ned Deily:

So, to really support
Tk 8.6, the only viable option at the moment would be for us to ship our
own versions of Tk, like the Windows installer does.  But it wouldn't be
acceptable, IMO, to force other projects and users to migrate to 8.6 in
the middle of a release cycle, e.g. 3.4.x or 2.7.x.  Providing it as an
option, though, would be OK.


Hmm, I'm not sure that the other projects would need an update. In Tcl 
world, there is the concept of stub libraries, an extra level of 
indirect linking provided by both the Tcl and Tk core. If the extensions 
link to the stub library (the standard way), they can be loaded into any 
later version of Tcl and do not directly depend on libtcl or libtk. If 
the extensions link directly to libtcl, they are either broken or very 
special (providing one's own interpreter, doing nasty stuff with 
internals etc.)


Christian
--
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-02 Thread Ned Deily
In article ,
 "Peter Tomcsanyi"  wrote:
> "Ned Deily"  wrote in message 
> news:nad-40cb03.10344701102...@news.gmane.org...
> > The python.org 3.4.x series of installers will likely never change from
> > linking with Tk 8.5 by default.  That would break a number of important
> > third-party Python packages that supply binary distributions built for
> > the python.org OS X pythons, like matplotlib.
> I respect your decision.
> But it surprises me because the Windows version of Python 3.4.1 already 
> comes with Tcl/Tk 8.6. Does it mean that there are no such problems with 
> matplotlib etc. in Windows?

The main issue is that, unlike MS and Windows, Apple has long shipped 
versions of Tcl and Tk with OS X.  As I understand it, Apple even helped 
sponsor the writing of the newer Cocoa-based Tk that would also work on 
64-bit systems after they decided to not extend the older Carbon APIs to 
64-bit, making the original OS X native Carbon-based Tk problematic on 
newer Macs and releases of OS X.  When the Cocoa Tk was first shipped 
with OS X 10.6, Tk 8.6 hadn't been released yet so they went with a 
backport to 8.5 and, for whatever reasons, Apple has been very slow to 
upgrade their 8.5.x Tk since then and have not shipped a 8.6 version 
yet.  That leaves us in a bit of a quandary for the python.org 
installers.  Ideally, we'd just like to continue to depend on an 
Apple-supplied version but even the most recent releases of OS X ship 
with serious bugs.  Fortunately, it's been possible and long been our 
practice to ship the python.org installers Pythons built in such a way 
that, at run time, they will automatically use a compatible third-party 
Tcl and Tk, if present, otherwise fall back to the system version.  By 
far, the leading third-party distributor of Tcl/Tk is ActiveState and 
they are actively involved in the development and maintenance of Tcl and 
Tk.  But, their releases are not open-source and have a license that, 
while generous, do not permit totally unrestricted usage.  Thus it is 
problematic to depend totally on their releases. So, to really support 
Tk 8.6, the only viable option at the moment would be for us to ship our 
own versions of Tk, like the Windows installer does.  But it wouldn't be 
acceptable, IMO, to force other projects and users to migrate to 8.6 in 
the middle of a release cycle, e.g. 3.4.x or 2.7.x.  Providing it as an 
option, though, would be OK.

> I think that one of the point when advertising Python is that it works 
> accross the platforms, so keeping one platform (mac) "behind" for months 
> seems to me going against the multiplatform promise of Python...

I don't think we mean to imply that all of the third-party libraries 
that Python is able to use are the same across all platforms.  It 
depends on the platform and the practices there.  The fact is that Tk 
8.5 is still the de facto standard for OS X 10.6+ and Tk 8.4 is the de 
facto standard for OS X 10.5 and earlier systems, because that's what 
Apple has shipped.  And that's why matplotlib et al and we still ship 
binary installers for OS X with 8.5 support.  Third-party open source 
packages distributors, like MacPorts or Anaconda, can more easily move 
to newer versions of things, like Tk 8.6, because they provide complete 
solutions for many applications and libraries: they have ports for 
matplotlib, numpy, pythonx.x, Tk, and all other dependencies.  The 
python.org installers have a much more limited scope.

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-02 Thread Peter Tomcsanyi

Thanks again for quick and informative reply.

"Ned Deily"  wrote in message 
news:nad-40cb03.10344701102...@news.gmane.org...

The python.org 3.4.x series of installers will likely never change from
linking with Tk 8.5 by default.  That would break a number of important
third-party Python packages that supply binary distributions built for
the python.org OS X pythons, like matplotlib.


I respect your decision.
But it surprises me because the Windows version of Python 3.4.1 already 
comes with Tcl/Tk 8.6. Does it mean that there are no such problems with 
matplotlib etc. in Windows?
I think that one of the point when advertising Python is that it works 
accross the platforms, so keeping one platform (mac) "behind" for months 
seems to me going against the multiplatform promise of Python...



File an update request for the tcl and tk ports on the MacPorts tracker.
The project is usually very responsive to such requests.
https://trac.macports.org


Thanks for the suggestion, I was considering asking them, but I did not know 
what is the best place/best way to do it.



Note that ActiveState hasn't yet released their versions of 8.6.2.


I know, I am waching their Web page, too.


As Kevin Walzer points out, you *can* also build your own.

I know. But *can* is quite subjective.
Being a Windows-only user and programmer for a (too) long time, the idea 
that the end-user should compile something from sources is very 
unconfortable to me. So many things can go wrong it the process when working 
with toolchains that I am not familiar with.



Sorry for the delay!


You do not need to appologize, I understand that it is extra work and that 
you did not promise it for sure.


Best regards

Peter


--
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-01 Thread Ned Deily
In article ,
 "Peter Tomcsanyi"  wrote:
> "Ned Deily"  wrote in message 
> news:nad-d2ddcb.14070824062...@news.gmane.org...
> It's October...
> So I tried Python 3.4.2rc1 and it seems that it still links to Tk 8.5 on 
> Mac.
> Does it mean that there is no plan to link to Tk 8.6 in Python 3.4.2 on Mac?
> Or is there something that can override 8.5 to 8.6 as you wrote?

The python.org 3.4.x series of installers will likely never change from 
linking with Tk 8.5 by default.  That would break a number of important 
third-party Python packages that supply binary distributions built for 
the python.org OS X pythons, like matplotlib.  For Python 3.5, we will 
have the opportunity to change that.  

> In the meantime I tried MacPorts. It has Tk 8.6.1 so rotating text work 
> well, but it has still a problem with semi-transparency as described here:
> http://core.tcl.tk/tk/tktview?name=99b84e49ff
> It has been fixed in Tk 8.6.2 that is already published for nearly a month, 
> but there seems to be no uypdate on macports yet...

File an update request for the tcl and tk ports on the MacPorts tracker.  
The project is usually very responsive to such requests.

https://trac.macports.org

Note that ActiveState hasn't yet released their versions of 8.6.2.

> So I am quite frustrated that I am not able to make my Python installation 
> on Mac do the same things (namely roatting text and use png files that have 
> semi-transparent pixels) both on Windows and Mac.

As Kevin Walzer points out, you *can* also build your own.  I still 
intend to provide a downloadable solution for 3.4.x and 2.7.x; I hope to 
get back to it shortly.  Sorry for the delay!

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-01 Thread Kevin Walzer

On 10/1/14, 7:51 AM, Peter Tomcsanyi wrote:

"Ned Deily"  wrote in message
news:nad-d2ddcb.14070824062...@news.gmane.org...

The easiest option would be a downloadable package that would allow the
default python.org 8.5-linked _tkinter to be overridden with an 8.6
version.  There may be some news on that front in the near future.


It's October...
So I tried Python 3.4.2rc1 and it seems that it still links to Tk 8.5 on
Mac.
Does it mean that there is no plan to link to Tk 8.6 in Python 3.4.2 on
Mac?
Or is there something that can override 8.5 to 8.6 as you wrote?



The solution here is to build Python and Tcl/Tk yourself, in the 
versions you want, and then things should work just fine.



--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-01 Thread Peter Tomcsanyi
"Ned Deily"  wrote in message 
news:nad-d2ddcb.14070824062...@news.gmane.org...

The easiest option would be a downloadable package that would allow the
default python.org 8.5-linked _tkinter to be overridden with an 8.6
version.  There may be some news on that front in the near future.


It's October...
So I tried Python 3.4.2rc1 and it seems that it still links to Tk 8.5 on 
Mac.

Does it mean that there is no plan to link to Tk 8.6 in Python 3.4.2 on Mac?
Or is there something that can override 8.5 to 8.6 as you wrote?

In the meantime I tried MacPorts. It has Tk 8.6.1 so rotating text work 
well, but it has still a problem with semi-transparency as described here:

http://core.tcl.tk/tk/tktview?name=99b84e49ff
It has been fixed in Tk 8.6.2 that is already published for nearly a month, 
but there seems to be no uypdate on macports yet...


So I am quite frustrated that I am not able to make my Python installation 
on Mac do the same things (namely roatting text and use png files that have 
semi-transparent pixels) both on Windows and Mac.


Best regards

Peter



--
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-27 Thread Peter Tomcsanyi


"Christian Gollwitzer"  wrote in message 
news:loh45o$14g$1...@dont-email.me...
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 will try it on the Mac, but on Windows this does not work (with python.org 
installation of Python), and I need to have the same environment on both Win 
and Mac (at least).


On the Mac you can create an APP bundle which contains everything, 
including extra dependencies.


Thanks for the hint, I may consider it, but maybe it is not applicable to my 
project where the outcome should be in fact a few modules in Python and the 
en-users (college students) should program in Python using IDLE and those 
extra modules. So there is no "Main program" and there will be no 
"application".

Is an APP budle applicable for such a situation?

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.


Thanks for many insights into Tk and your hints.
I will try some of them in next days and maybe later I will come with some 
more questions.


Peter


--
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-26 Thread Ned Deily
In article ,
 Christian Gollwitzer  wrote:

> Am 26.06.14 14:37, schrieb Christian Gollwitzer:
> > Am 26.06.14 12:39, schrieb Peter Tomcsanyi:
> >> "Christian Gollwitzer"  wrote in message
> >> news:lofciv$nq6$1...@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...
> >
> >  On my Mac it came with the OS (I
> > think); you'll do Tk.eval("package require Img").
> Just checked back with my vanilla VM install of Snow Leopard (10.6), 
> that the Img package is installed. So doing this package require Img in 
> case you detect 8.5 should solve your PNG problem on the Mac (you can do 
> "package require Tk" to get the version number). I haven't checked alpha 
> channel, though. For the rotated text there is no good solution. Of 
> course, pushing people to install 8.6 is better:)

Just a reminder that you should *not* depend on the Apple-supplied Tk 
8.5 in OS X 10.6.  That was the first release of Cocoa Tk and it has 
proven to be almost unusable, at least with IDLE and some other 
Tkinter-based apps.  Install a newer Tcl/Tk 8.5.x, like from ActiveTcl, 
and use a python that links with it, like from the python.org 
installers. The ActiveTcl installer also installs "teacup" which allows 
you to easily install additional Tcl packages.

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-26 Thread Christian Gollwitzer

Am 26.06.14 14:37, schrieb Christian Gollwitzer:

Am 26.06.14 12:39, schrieb Peter Tomcsanyi:

"Christian Gollwitzer"  wrote in message
news:lofciv$nq6$1...@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...


 On my Mac it came with the OS (I
think); you'll do Tk.eval("package require Img").


Just checked back with my vanilla VM install of Snow Leopard (10.6), 
that the Img package is installed. So doing this package require Img in 
case you detect 8.5 should solve your PNG problem on the Mac (you can do 
"package require Tk" to get the version number). I haven't checked alpha 
channel, though. For the rotated text there is no good solution. Of 
course, pushing people to install 8.6 is better:)


Christian

--
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-26 Thread Christian Gollwitzer

Am 26.06.14 12:39, schrieb Peter Tomcsanyi:

"Christian Gollwitzer"  wrote in message
news:lofciv$nq6$1...@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

--
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-26 Thread Peter Tomcsanyi
"Christian Gollwitzer"  wrote in message 
news:lofciv$nq6$1...@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...
And finally I want to show the picture(s) on a Tk-based Canvas on top of 
each other with properly handled semi-transparency.


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.
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.


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) when I started with 
Python+Tk a few months ago, so I was very glad to see it in 8.6 and I 
immediately started using it on Windows. But then I receved complaints from 
a Mac user that it just does not work...


Peter


--
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-25 Thread Christian Gollwitzer

Am 25.06.14 21:26, schrieb Peter Tomcsanyi:

"Christian Gollwitzer"  wrote in message
news:lodruv$k45$1...@dont-email.me...

may I ask which features of 8.6 you need in particular?


I need two of them:
- Angled text
- PNG image support with alpha channel (even if it seems a bit limited,
particularly I still did not find the way to programmatically set/read
the alpha channel of one individual pixel of the image, but maybe it is
just my inability and a question to another newsgroup).


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. 
After loading these, Tk 8.5 will accept PNG as in 8.6. 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. Glad to see, that you are pushing 
the adoption of 8.6 ;) (I'm a Tcl-guy)


Christian
--
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-25 Thread Peter Tomcsanyi
"Christian Gollwitzer"  wrote in message 
news:lodruv$k45$1...@dont-email.me...

Hi Peter,
may I ask which features of 8.6 you need in particular?


Hi Christian,

I need two of them:
- Angled text
- PNG image support with alpha channel (even if it seems a bit limited, 
particularly I still did not find the way to programmatically set/read the 
alpha channel of one individual pixel of the image, but maybe it is just my 
inability and a question to another newsgroup).


Peter


--
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-25 Thread Kevin Walzer

On 6/25/14, 1:49 AM, wxjmfa...@gmail.com wrote:

I can also add, tcl or tk or tkinter (8.6) is on Windows
quite buggy. In fact, simply*unusable*.


How so?

Please report bugs at http://core.tcl.tk/tcl/reportlist or 
http://core.tcl.tk/tk/reportlist, as needed.


--Kevin

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
--
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-25 Thread Ned Deily
In article ,
 "Peter Tomcsanyi"  wrote:
> Many thanks for the quick reply.
> I will try the MacPorts version, but I am quite Windows-based (I do the Mac 
> installation for somebody else), so I am not sure how to install all the 
> other packages that we use (NumPy, MatPlotLib, Pillow and maybe something 
> else that I do not recall at this moment...). Last time (for the python.org 
> version of Python) I needed to try out several approached from several sites 
> to succeed finally...

MacPorts provides ports for all of those, generally under names like 
py34-matplotlib, py34-Pillow, etc.

http://www.macports.org/ports.php

> So I will impatiently expect the changes "on that front" and I will hope 
> that they will come till August 2014.

Keep your fingers crossed.

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-25 Thread Christian Gollwitzer

Hi Peter,

Am 24.06.14 20:11, schrieb Peter Tomcsanyi:

I use the Python 3.4.1 installer from
https://www.python.org/downloads/release/python-341/

The Windows installation comes with Tcl/Tk version 8.6 which has some
new features (compared to 8.5) that are very important to me.


may I ask which features of 8.6 you need in particular? I'm just 
curious, because I thought that Python mainly uses the Tk part, and 
there has not been much of a difference in Tk between 8.5 and 8.6. In 
contrast, the Tcl language itself got massively enhanced (stackless 
execution engine, coroutines, core OO system, ...)


Christian
--
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-24 Thread Peter Tomcsanyi
"Ned Deily"  wrote in message 
news:nad-d2ddcb.14070824062...@news.gmane.org...

Probably easier, though, is to install Python 3.4 from MacPorts which
does provide its own version of Tcl/Tk 8.6.1, the Cocoa version by
default or optionally an X11 version:

# after installing the base MacPorts
sudo port selfupdate
sudo port install py34-tkinter +quartz
/opt/local/bin/python3.4

The easiest option would be a downloadable package that would allow the
default python.org 8.5-linked _tkinter to be overridden with an 8.6
version.  There may be some news on that front in the near future.


Many thanks for the quick reply.
I will try the MacPorts version, but I am quite Windows-based (I do the Mac 
installation for somebody else), so I am not sure how to install all the 
other packages that we use (NumPy, MatPlotLib, Pillow and maybe something 
else that I do not recall at this moment...). Last time (for the python.org 
version of Python) I needed to try out several approached from several sites 
to succeed finally...


So I will impatiently expect the changes "on that front" and I will hope 
that they will come till August 2014.


Peter Tomcsanyi


--
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-24 Thread Ned Deily
In article ,
> Maybe this is not the right place for this kind of question... can anyone 
> suggest a better place so that the question has a chance to be read by the 
> person who is actually creating the installation packages? Should I try to 
> send this as a bug to bugs.python.org?

P.S. Yes, in general, issues with the python.org binary installers for 
Windows and OS X can be addressed through bugs.python.org.

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-06-24 Thread Ned Deily
In article ,
 "Peter Tomcsanyi"  wrote:
> I use the Python 3.4.1 installer from
> https://www.python.org/downloads/release/python-341/
> 
> The Windows installation comes with Tcl/Tk version 8.6 which has some new 
> features (compared to 8.5) that are very important to me.
> 
> But the Mac installer does not include Tcl/Tk and the page:
> https://www.python.org/download/mac/tcltk
> says:
> "The Python 64-bit/32-bit Mac OS X installers for Python 3.4.x, 3.3.x, 
> 3.2.x, and 2.7.x dynamically link to Tcl/Tk 8.5 frameworks."
> 
> I tried to download and install ActiveTcl 8.6.1 for Mac, but Python does not 
> use it...
> 
> Can anyone help me make Python 3.4.1 use Tcl/Tk 8.6 on Mac OS X (10.9.2, if 
> that matters)?
> 
> Does anyone know why the Windows installer brings the newest version of 
> Tcl/Tk while the Mac installer remains with the previous version? When this 
> is planned to be changed?

The main reason is that we have tried to follow what Apple does with OS 
X.  Unlike Windows, OS X is shipped with Apple-supplied versions of 
Tcl/Tk.  For OS X 10.6, Apple helped support the development of a new 
native variant of Tk for OS X (the Cocoa Tk) that supports 64-bit mode.  
The previous OS X native mode Tk (Carbon) only works in 32-bit 
processes.  At the time of the release of 10.6, Tk 8.6 was not yet 
released.  For whatever reasons, Apple has continued to ship only 8.5 
and 8.4 in releases through current 10.9.x.  Unfortunately, it has 
turned out that Cocoa Tk has had a number of very serious bugs.  Many of 
them have been fixed in newer releases of 8.5.x and the now-released 
8.6.x but remain unfixed in the older versions of 8.5.x shipped by 
Apple.  Also, up until relatively recent releases, there were issues 
with Python's Tkinter when built and linked with Tk 8.6.x.  We think 
most of those issues should have been fixed in the current releases 
(like 3.4.1).  But, because of the messy situation with Tk support on OS 
X, there really hasn't been an incentive for us to move to 8.6.x for the 
python.org OS X installers; it's been challenging enough to get 8.5.x 
stable.  Another issue is that there are binary installers for some 
popular third-party packages for Python on OS X that depend on the 
python.org installers and also depend on Tk (like matplotlib) so any 
change in Tk version would affect them as well. At some point, I would 
like to move to 8.6.x or at least make it an option but we don't have a 
schedule for it yet.

It's a bit messy to try to build Python with Tk 8.6 yourself from source 
but it can be done if you don't mind not using the python.org version.  
To do so, make sure you have ActiveTcl 8.6 installed and that it is the 
"Current" version in the /Library/Frameworks for Tcl and Tk.  Then 
configure Python for a framework build (--enable-framework).

Probably easier, though, is to install Python 3.4 from MacPorts which 
does provide its own version of Tcl/Tk 8.6.1, the Cocoa version by 
default or optionally an X11 version:

# after installing the base MacPorts
sudo port selfupdate
sudo port install py34-tkinter +quartz
/opt/local/bin/python3.4

The easiest option would be a downloadable package that would allow the 
default python.org 8.5-linked _tkinter to be overridden with an 8.6 
version.  There may be some news on that front in the near future.

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list