[Tkinter-discuss] Basic Tkinter help

Michael O'Donnell michael.odonnell at uam.es
Thu Jan 22 08:53:07 CET 2009


Dear Ru-D,

The following line makes one window:

> root = Tk()

And your other line makes another:

> app = APP(root)   (APP being a Toplevel window)

So the root.withdraw() is quite correct (many of us use it, that is if
we don't make use of the main window for the application itself).

Mick

On Thu, Jan 22, 2009 at 2:50 AM, Ru-D <red_haired_freak at hotmail.com> wrote:
>
> I am relatively new to Tkinter and am finding some simple problems difficult
> to understand/rectify
>
> The following code displays two windows; my maximised application window and
> a small window called Tk:
>
>
> from Tkinter import *
>
> class APP(Toplevel):
>    def __init__(self, master):
>        Toplevel.__init__(self, master)
>        self.master = master
>
> root = Tk()
> app = APP(root)
> app.state("zoomed")
> app.title("Title")
>
> root.mainloop()
>
> I can fix this by inserting the line root.withdraw() after root = Tk() but
> this seems like a clumsy solution to me. Could someone please help me
> understand why two windows are being made and suggest a better way to do
> this.
>
> Thanks,
> Ru-D
> --
> View this message in context: http://www.nabble.com/Basic-Tkinter-help-tp21593746p21593746.html
> Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
>
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>


More information about the Tkinter-discuss mailing list