[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 18:20:53 CET 2008


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?


On Tue, Mar 18, 2008 at 12:22 PM, Kevin Walzer <kw at codebykevin.com> wrote:
> Jonathan Frankel wrote:
>  > When I put this code (using self.tk... instead of root.tk...) in the
>  > __init__ method I get an error:
>  >
>  > AttributeError: App instance has no attribute 'tk'
>  >
>
>  Here's my __init__ code:
>
>  class phynchronicityApp(Tk):
>
>      def __init__(self, parent):
>          Tk.__init__(self, parent)
>          try:
>
>              self.tk.call('console', 'hide')
>          except TclError:
>              pass
>          self.masterlist = []
>          self.makePrefsDir()
>          self.registerHelpBook()
>          self.makeImages()
>          self.readPrefs()
>
>  What version of OS X/Python/Tk are you using?
>
>  --
>
>
> Kevin Walzer
>  Code by Kevin
>  http://www.codebykevin.com
>


More information about the Tkinter-discuss mailing list