[Pythonmac-SIG] tkinter, py2app, and the console
Brian Lenihan
brian_l at mac.com
Wed Nov 23 10:45:12 CET 2005
On Nov 20, 2005, at 3:27 PM, Bob Ippolito wrote:
>
> On Nov 20, 2005, at 2:47 PM, Jon Rosebaugh wrote:
>
>> On 11/20/05, Brian Lenihan <brian_l at mac.com> wrote:
>>> I'm not sure really why this happens. I work around it using
>>> something
>>> like this in the initialization code:
>>>
>>> if hasattr(sys, 'frozen'):
>>> app.top.tk.call('console', 'hide')
>>
>> Thanks, that worked wonderfully.
>
> I think this functionality lives in AquaTclTk itself in order to
> facilitate Wish. There's probably an environment variable or plist
> setting to turn it off somewhere, but you'd have to ask the Tk
> folks or read the source. Definitely not anywhere near Python
> land, either way.
On Nov 20, 2005, at 3:27 PM, Bob Ippolito wrote:
>
> On Nov 20, 2005, at 2:47 PM, Jon Rosebaugh wrote:
>
>> On 11/20/05, Brian Lenihan <brian_l at mac.com> wrote:
>>> I'm not sure really why this happens. I work around it using
>>> something
>>> like this in the initialization code:
>>>
>>> if hasattr(sys, 'frozen'):
>>> app.top.tk.call('console', 'hide')
>>
>> Thanks, that worked wonderfully.
>
> I think this functionality lives in AquaTclTk itself in order to
> facilitate Wish. There's probably an environment variable or plist
> setting to turn it off somewhere, but you'd have to ask the Tk
> folks or read the source. Definitely not anywhere near Python
> land, either way.
On Nov 20, 2005, at 3:27 PM, Bob Ippolito wrote:
On Nov 20, 2005, at 2:47 PM, Jon Rosebaugh wrote:
On 11/20/05, Brian Lenihan <brian_l at mac.com> wrote:
I'm not sure really why this happens. I work around it using something
like this in the initialization code:
if hasattr(sys, 'frozen'):
app.top.tk.call('console', 'hide')
Thanks, that worked wonderfully.
I think this functionality lives in AquaTclTk itself in order to
facilitate Wish. There's probably an environment variable or plist
setting to turn it off somewhere, but you'd have to ask the Tk folks
or read the source. Definitely not anywhere near Python land, either
way.
Well, the easiest way(tm) to sidestep the problem actually does live
in Python land. Consider the following tk code fragments found in
tkMacOSXInit.c:
* If we don't have a TTY and stdin is a special character file of
length 0,
* (e.g. /dev/null, which is what Finder sets when double clicking Wish)
* then use the Tk based console interpreter.
....
/* Only show the console if we don't have a startup script */
if (Tcl_GetStartupScript(NULL) == NULL) {
Tcl_SetVar(interp, "tcl_interactive", "1", TCL_GLOBAL_ONLY);
Ouch.
Even if a non-python solution was found in an environment variable or
a plist, I still dislike editing plists or setting environment
variables when the changes I need are local, but the scope of the
changes is global, unless I have no other obvious choices. How much
of my life am I willing to waste looking for the "correct" solution,
when a working solution has made itself obvious? (The obvious answer
is that it depends on who is asking). The normal result is that I
will most likely forget the global changes I made and then have to
wonder why something completely unrelated to my changes fails to work
as expected. A not-very-pythonic-result.
More information about the Pythonmac-SIG
mailing list