Answers for "get id widget tkinter"

0

get 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>
Posted by: Guest on April-24-2020

Python Answers by Framework

Browse Popular Code Answers by Language