[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 16:48:59 CET 2008


Hmm...this isn't working for me...

This is a sketch of what I've got:

from Tkinter import *

class App:
    def __init__(self, master):
        self.frame = Frame(master)
        self.frame.pack()
        ...etc...

def main():
    root = Tk()
    try:
        root.tk.call('console','hide')
    except TclError:
        pass
    app = App(root)
    root.mainloop()

Should I put "self.tk.call('console','hide')" somewhere else in the code?

Humbly,
Jonathan

On Tue, Mar 18, 2008 at 11:23 AM, Kevin Walzer <kw at codebykevin.com> wrote:
>
> Jonathan Frankel wrote:
>  > Hi all,
>  >
>  > I've written a little app that looks quite handsome on OS X, much more
>  > than on Windows, but when I double click on it to open it (and the
>  > default is to launch using Python Launcher), a console appears in the
>  > background, and then even stays open after I close the Tkinter window.
>  > On Windows I changed the extension to .pyw and it works fine--no
>  > command prompt in the background.
>  >
>  > How do I run a Tkinter application on OS X without having a console
>  > window appear in the background?
>  >
>  > Thanks much,
>  > Jonathan
>
>  Something like this works for me:
>
>         try:
>              self.tk.call('console', 'hide')
>          except TclError:
>              pass
>
>  HTH,
>  Kevin
>
>  --
>  Kevin Walzer
>  Code by Kevin
>  http://www.codebykevin.com
>


More information about the Tkinter-discuss mailing list