0

I would like to change the name of a widget like this example :

window = Tk()
window.mainloop()
test_frame = Frame(window, name="test_frame")
test_frame.config(name="test_frame_name")

Do you have any solution to do something like this ? I always get an error like _tkinter.TclError: unknown option "-name" Thanks for your help

JorisV
  • 1
  • 3
  • 2
    What's are you trying to accomplish by changing the "name" of a widget? As the error message tells you, tkinter has no "name" option for widgets, so there's nothing tkinter itself would ever do with a "name". – fhdrsdg Sep 01 '21 at 08:24
  • 1
    As @ fhdrsdg said, there is no use for widget names in `tkinter`. If you really want to rename a widget, look at [this](https://stackoverflow.com/a/40618152/11106801). There a text widget is renamed. – TheLizzard Sep 01 '21 at 09:21

1 Answers1

2

Internally, the name is used as the unique identifier for the widget and cannot be changed once the widget has been created.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685