How to find an object existing?

dieter dieter at handshake.de
Thu Jun 14 00:48:46 EDT 2018


huey.y.jiang at gmail.com writes:
> root = Tkinter.Tk()
> button = Tkinter.Button(root, text="Find me")
> button.pack()
>
> I created a button, Python object. I recall I can check this object existing by using   winfo, such as  winfo.exists(button). However, I forgot which super class contains this   winfo   method.  I printed out dir(os), dir(sys), dir(Tkinter), but did not find this winfo method. I wonder who will be kindly drop down a few lines? Thanks a lot!

Python is suggesting some naming conventions. Those state, that
classes are using camel-case names. If they are applied, "winfo" is
not a class - but instead either an object (= class/type instance)
or a module.

"winfo" is obviously related to graphical objects (windows, in particular).
This means, you wont find it in "pure" Python. If it exists,
it belongs to "Tkinter".

I would look for "winfo" (or "WInfo" (potentially slightly
differently camel-cased)) in the "Tk[inter]" documentation.

Note, that "Tkinter" is a Python binding for the "tk" library.
If you find something in the "tk" documentation, it is likely
"translated" in a uniform way (to other "tk" objects) for "Tkinter".




More information about the Python-list mailing list