Is it 'fine' to instantiate a widget without parent parameter?
jfong at ms4.hinet.net
jfong at ms4.hinet.net
Sun Sep 8 07:01:04 EDT 2019
David於 2019年9月8日星期日 UTC+8下午6時44分55秒寫道:
> On Sun, 8 Sep 2019 at 20:25, <jfong at ms4.hinet.net> wrote:
> >
> > If I have two widgets created this way:
> > t0 = tkinter.Text()
> > t1 = tkinter.Text()
> > How many Tk objects will there be?
>
> $ python3
> Python 3.5.3 (default, Sep 27 2018, 17:25:39)
> [GCC 6.3.0 20170516] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import tkinter
> >>> t0 = tkinter.Text()
> >>> t1 = tkinter.Text()
> >>> t0 is t1
> False
> >>> t0
> <tkinter.Text object .140259669565736>
> >>> t1
> <tkinter.Text object .140259669542280>
> >>>
Sorry, didn't make it clear. I mean <tkinter.Tk object .>
--Jach
More information about the Python-list
mailing list