Tcl/Tk ???

buc99

Don't Tread on Me!
I'm running 10.2.

When I give the following command in my shell:
%which tclsh

I get:
/usr/bin/tclsh

Does anyone know if Tcl and Tk are installed natively? And if so, how come I keep getting an error when I try to import the Tkinter module in python:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 35, in ?
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter


This usually means that Tk is not installed properly I think.

Any ideas?

Thanks.
SA
:)
 
I wrestled with this same problem last week for several days. Never did get it to work. Sorry don't have better answer - it appears OS X implementation of Python is weak. On top of that attempting to fix th problems installing Python manually (as you did) did not solve the problem.

BTW - I get teh EXACT same err msg you are getting.
 
Although Tcl seems to be installed, there is no native Tk.

So the reason why Python throws that error is because the default python is installed without Tk support. What you need to do is download the Aqua Tk and install the frameworks then build the Python 2.2 source to support Tk. For more info on hoe to do this goto:

http://tony.lownds.com/macosx/

Click on the 'this page' link under Tkinter support. It has directions for building python with 'Aqua Tkinter' support.

I still wished Apple would incorporate scripting languages python, perl and ruby into their cocoa development like they did with Java. Oh well, one can dream.

Hope this helps. Let me know what success you have with it.

SA:)
 
Why not just use XDarwin instead? At least then you wouldn't get confused with apps which look, but don't behave like mac apps |-\

Plus it'll actually work.
 
Why not just use XDarwin instead?

That would be too easy;)

I can do that, but what I really wish to do is push some developers to move the 'Aqua Tkinter' project along.

XDarwin is just a cheap work-around. I wish to get this stuff as native as possible because these our powerful development tools on Unix and OSX is Unix (somewhat).

Thanks.
SA
 
If Tk were an API actually capable of making apps which behaved like Mac apps I would support the effort.

Needless to say, I don't |-p
 
Why not bring it into Cocoa then?

They brought Java in and it interfaces with the Aqua Gui, would it be difficult to bring in Perl, Python and maybe Ruby also?

Thanks.

SA
 
Java Swing???

I was talking of Java/Cocoa. This uses the GUI elements of Cocoa and attaches Java classes. It would be nice if Apple could do the same foe Perl, Python, etc...

Thanks.
SA
:)
 
Originally posted by strobe
Actually Java Swing apps do NOT conform to Apple's HI guidelines!

grr!

Frankly, I have a hard time believing that they conform to anybody's interface guidelines. Most of them are butt ugly and cluttered to begin with, and when you try cramming the Aqua interface elements into the frame, it looks like quite the train wreck.

I'd take Interface Builder over that mess any day.
 
That is what I'm talking about.

When you use the "Interface Builder" it allows you to chose between making an objC app or Java app. It uses the Aqua gui not swing or awt. And it embeds Java code into thes objects.(General explanation) So why would it be so hard for Apple to also allow the option to use Perl or Python code instead of the two options that are given? Python can be wrapped in C or Java, why not use it in the "interface Builder" also?

Just my questions.

Thanks.
SA
:)
 
Well, I found this file buried on my disk:

/Library/Perl/darwin/auto/PerlObjCBridge

So my guess is that getting Perl working with Interface Builder probably wouldn't be all that difficult. Heck if I know how to do it, though. :)
 
Heh, that's petty cool...

Of course exposing the Foundation and AppKit API to another language is probably one of the easier things to do since it's all a matter of passing messages (instead of a function call where the structure of every call is static).

I think I'll stick to ObjC and C though |-\
 
Back
Top