473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Does PIL work with Tk 8.5?

I'm using a build of Python 2.5.1 on OS X 10.5.1 that links to Tk 8.5.
Trying to test PIL with this new build, Python barfs when trying to
display an image in a Tkinter Label. Here is my sample code:

---
from Tkinter import *
import Image, ImageTk

root = Tk()

im = Image.open('/Users/kevin/Desktop/to.jpg')
newim = im.resize((16, 16))

labelimage = ImageTk.PhotoImage(newim)

w = Label(root, text="My Test Icon", image=labelimage, width=100)
w.image=labelimage
w.pack()

mainloop()
--

Here's the error message:

Macintosh:Desktop kevin$ python iconlabel.py
alloc: invalid block: 0x5c32b4: 5d 0 0

Abort trap
Macintosh:Desktop kevin$
The build of PIL was made against the pre-compiled binary of Python for
OS X (from python.org) that links to Tk 8.4.

Since Python itself is the same version number (2.5.1), the only thing I
can find to account for the crash is the different version of Tk--could
this be making a difference, or am I doing something wrong?

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Jan 7 '08 #1
4 1618
Since Python itself is the same version number (2.5.1), the only thing I
can find to account for the crash is the different version of Tk--could
this be making a difference, or am I doing something wrong?
Yes, Tk 8.5 isn't quite compatible with existing Tkinter code; there
have been a lot of changes which break Tkinter applications (though not
Tkinter itself).

OTOH, it's more likely that the PIL binaries you are using conflict with
your Tk installation - if the binaries were for Tk 8.4 (which isn't
quite clear to me whether that's indeed the case), then they can't work
with Tk 8.5, as Tk doesn't provide that kind of binary compatibility.

Regards,
Martin
Jan 7 '08 #2
Martin v. Löwis wrote:
OTOH, it's more likely that the PIL binaries you are using conflict with
your Tk installation - if the binaries were for Tk 8.4 (which isn't
quite clear to me whether that's indeed the case), then they can't work
with Tk 8.5, as Tk doesn't provide that kind of binary compatibility.
Tk itself has a stubs mechanism that allows libraries compiled against
earlier versions to be used with later versions. It's different than
Python in this respect. A pure-Tk library (such as Img or TkPNG) built
against Tk 8.4 would not require re-compilation to be used with 8.5.
Since PIL is a Python library, however, you may be right.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Jan 7 '08 #3
Kevin Walzer wrote:
>
Tk itself has a stubs mechanism that allows libraries compiled against
earlier versions to be used with later versions. It's different than
Python in this respect. A pure-Tk library (such as Img or TkPNG) built
against Tk 8.4 would not require re-compilation to be used with 8.5.
Since PIL is a Python library, however, you may be right.
Indeed, this appears to be the problem. I tested my script against the
Python bundled with Mac OS X, which links against 8.4, and it worked fine.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Jan 7 '08 #4
Tk itself has a stubs mechanism that allows libraries compiled against
earlier versions to be used with later versions. It's different than
Python in this respect. A pure-Tk library (such as Img or TkPNG) built
against Tk 8.4 would not require re-compilation to be used with 8.5.
Since PIL is a Python library, however, you may be right.
But aren't the older binaries linked, in a hard-coded manner, against
libtk8.4.so.0 (or .dylib)? If so, how does it help that the Tcl stub
layer could still provide binary compatibility? Won't the operating
system load and use the older Tk version *anyway*?

Regards,
Martin
Jan 7 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
3
by: Julian | last post by:
Hi I am trying to update a date field in my table but some how this simple code does not work, I know the select work because if I write the fields, it will show the data from the table but why...
5
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug...
22
by: Robert Bralic | last post by:
CAN anybody tell me any address where I can download some small(1000-2000) lines C++ proghram source. Or send me ,a small(1000-2000) lines C++ program source that I can compille with gpp under...
12
by: Frank Hauptlorenz | last post by:
Hello Out there! I have a DB2 V7.2 Database (Fix11) on Win 2000 Professional. It was before a NT 4 based Domain - now it is a Win 2000 Domain. The database server is a domain member. Now...
0
by: Jarod_24 | last post by:
How does tabindex work in ASP .net pages I dosen't seem to work quite like in regular forms. and there isn't any TabStop property either. 1 .How do you prevent a control form beign "tabbed"....
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
89
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
14
by: webEater | last post by:
I have a problem, it's not browser specific, and I don't get a solution. I have an (X)HTML document, I show you a part of it: .... <!--<div class="pad">--> <div id="eventImages"><img src=""...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.