[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:58:52 CET 2008


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'


On Tue, Mar 18, 2008 at 11:51 AM, Kevin Walzer <kw at codebykevin.com> wrote:
> Jonathan Frankel wrote:
>  > 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
>
>  I put the code in the __init__ method.
>
>  What exactly is going on?
>
>  --
>
>
> Kevin Walzer
>  Code by Kevin
>  http://www.codebykevin.com
>


More information about the Tkinter-discuss mailing list