codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is it 'fine' to instantiate a widget without parent parameter?


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