David於 2019年9月8日星期日 UTC+8下午8時14分03秒寫道:
> On Sun, 8 Sep 2019 at 21:05, <jf...@ms4.hinet.net> wrote:
> > David於 2019年9月8日星期日 UTC+8下午6時44分55秒寫道:
> > > On Sun, 8 Sep 2019 at 20:25, <jf...@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?
> 
> > Sorry, didn't make it clear. I mean <tkinter.Tk object .>
> 
> Sorry I didn't read more carefully.
> But I think that the method I demonstrated can give
> the answer to your question.
> 
> >>> import tkinter
> >>> t0 = tkinter.Text()
> >>> t1 = tkinter.Text()
> >>> t0.master
> <tkinter.Tk object .>
> >>> t1.master
> <tkinter.Tk object .>
> >>> t0.master is t1.master
> True
> >>>

Thank you. After a quick trace to find out the reason, I found that Tkinter 
prevents Tk() be called more than once from widget constructors, so only one Tk 
object exists:-)

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

Reply via email to