What does calling Tk() actually do?

前端 未结 3 1737
天命终不由人
天命终不由人 2020-12-28 08:50

I was brushing up on Tkinter when I looked upon a minimal example from the NMT Tkinter 8.5 Reference.

#!/usr/bin/env python
import tkinter as tk

class Appli         


        
3条回答
  •  隐瞒了意图╮
    2020-12-28 09:40

    Sometimes some widgets run Tk() on their own. But I don't know which widgets and why.

    Sometimes it runs even if you don't use mainloop() - mostly on Windows.

    Tkinter is strange wrapper on Tcl/Tk :)

    But I prefer to use root = Tk() and root.mainloop() always.

提交回复
热议问题