Python Forum
[Tkinter] Inheritance
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Inheritance
#2
Startframe is subclassed from Frame. Parent/child is a different relationship. Replace parent with superclass and child with subclass in your description.

You can see all the attributes of any class, built-ins, downloaded or your own modules. In many cases you can even see the code. From the Python shell:
Output:
>>> import inspect >>> print(inspect.getsource(tkinter.Frame.pack_forget)) def pack_forget(self): """Unmap this widget and do not use it for the packing order.""" self.tk.call('pack', 'forget', self._w)
Not very interesting since all the fun stuff is done in "C".

I think the main thing you are getting from frame is the ability to add child widgets. Frame/Button is a parent/child relationship. Not class inheritannce, but the parent Frame object contains the child Button object
Reply


Messages In This Thread
Inheritance - by Heyjoe - Feb-14-2021, 09:19 PM
RE: Inheritance - by deanhystad - Feb-15-2021, 05:29 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020