Terry Reedy於 2019年9月8日星期日 UTC+8下午5時31分34秒寫道:
> On 9/7/2019 9:44 PM, jf...@ms4.hinet.net wrote:
> > I know it is valid, according to the Tkinter source, every widget 
> > constructor has a 'master=None' default. What happens on doing this?
> 
> Tkinter creates a default Tk object and uses that as the master.
> 
>  >>> t = tkinter.Text()
>  >>> t.master
> <tkinter.Tk object .>
> 
> > In what circumstance, we do it this way? and will it cause any trouble?
> 
> I believe it is OK if you always do it that way within a single 
> application.  But I prefer to have an explicit reference and use that 
> for .after calls and some others.
> 
> 
> -- 
> Terry Jan Reedy

If I have two widgets created this way:
t0 = tkinter.Text()
t1 = tkinter.Text()
How many Tk objects will there be?

--Jach
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to