[Tkinter-discuss] Opening a .py that uses Tkinter on OS X pops open a console window
Jonathan Frankel
jonathan at wikiterra.net
Tue Mar 18 23:00:37 CET 2008
Okay, so I was instantiating differently. But now...when I run that
code (I'm running exactly what you posted), I get:
invalid command name "console"
inside the console, and the console stays open. If I do it without
catching the error, I get the additional info:
...
self.tk.call('console','hide')
_tkinter.TclError: invalid command name "console"
and the whole thing crashes. This happens both on OS X and WinXP...
I can't even find which module this 'call' method originate from, so I
can't find out how it works. Does anyone know about tk.call?
On Tue, Mar 18, 2008 at 2:38 PM, Kevin Walzer <kw at codebykevin.com> wrote:
> Jonathan Frankel wrote:
> > I'm on 10.4.11, and I just updated python to the most recent version,
> > with the Tkinter that came with it.
> >
> > When I do this:
> >
> >
> > class App(Tk):
> >
> > def __init__(self, parent):
> >
> > Tk.__init__(self, parent)
> >
> > try:
> > self.tk.call('console','hide')
> > except TclError:
> > pass
> >
> > I get another error when I run it:
> >
> >
> > ...., line 19, in __init__
> > Tk.__init__(self, parent)
> > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py",
> > line 1636, in __init__
> > self.tk = _tkinter.create(screenName, baseName, className,
> > interactive, wantobjects, useTk, sync, use)
> > TypeError: create() argument 1 must be string or None, not instance
> >
> >
> > Is this related to how I'm instantiating my App object (app=App(root))
> > in the first place?
> >
>
> Not sure.
>
> This works for me:
>
> from Tkinter import *
>
>
> class App(Tk):
>
> def __init__(self, parent):
>
> Tk.__init__(self, parent)
>
> try:
> self.tk.call('console','hide')
> except TclError, msg:
> print msg
>
> if __name__ == '__main__':
> app = App(None)
> app.mainloop()
>
>
>
>
> --
>
>
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.com
>
More information about the Tkinter-discuss
mailing list