Holen Sie sich ID -Widget tkinter
You can override the auto-generated name by giving a name when you create a widget, using the
name parameter. You can then use str to get the name.
For example:
>>> import Tkinter as tk
>>> root = tk.Tk()
>>> f = tk.Frame(root, name="foo")
>>> b1 = tk.Button(f, name="b1")
>>> str(b1)
'.foo.b1'
>>> root.nametowidget(".foo.b1")
<Tkinter.Button instance at 0x100795488>
>>> b1
<Tkinter.Button instance at 0x100795488>
Muddy Magpie