[Pythonmac-SIG] MachoPython 2.2.2 build works; 3 minor
questions
Russell E Owen
owen@astro.washington.edu
Tue, 12 Nov 2002 08:39:51 -0800
>On vrijdag, nov 8, 2002, at 18:56 Europe/Amsterdam, Russell E Owen wrote:
>>>>2) Is it possible to make a Python/Tkinter source file that can
>>>>be run as a command (i.e. that has a working #! line...
>>>
>>>#! /Applications/Python.app/Contents/MacOS/python
>>>Not pretty, but it works.
>>
>>Unfortunately, it works exactly like #!/usr/local/lib/python: the
>>Python code runs (which is a big step forward from
>>#!/usr/local/bin/pythonw), but one cannot bring Tk windows to the
>>front!
>
>Strange... The first thing to check is whether this thing behaves as
>a "real" application. If it is a real application it should have a
>dock icon and a menubar. My guess is that it won't. (I.e. if you
>*do* have an icon and a menubar but you cannot bring windows to the
>front you've found a problem that is new to me).
You are correct: a Tk application works if and only if the Python
icon shows up in the toolbar.
>If it doesn't have an icon the problem is that the program isn't
>properly registered with the window server, and we have to find out
>why not. Try printing sys.executable at the top of your script. It
>should be /Applications/Python.app/Contents/MacOS/python . If it
>isn't: let us know what it is. If it is then somehow your python.app
>bundle is broken. Try rmoving it and building it again.
I tried that and the answer is indeed wrong:
% ./tkshbang.py
running sitecustomize.py
/usr/local/bin/python
where tkshbang.py is as follows:
#!/Applications/Python.app/Contents/MacOS/python
"""A minimal test of Tk"""
import sys
import Tkinter
print sys.executable
root = Tkinter.Tk()
text = Tkinter.Button(root, text="Test")
text.pack()
root.mainloop()
Any suggestions on what to try next? I suppose I may have screwed up
the build somehow, but I thought I was careful to follow the
instructions in the /Mac/OSX/README.