Python Forum
Help me understand this... (Classes and self).
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help me understand this... (Classes and self).
#8
Quote:I am trying to understand the process by which widgets are added to the GUI using classes in this manner.
You really should spend some time learning about classes in general.
a widget is a class as a matter of fact everything in python is a class
To show this, consider this example:
>>> a = 5
>>> type(a)
<class 'int'>
>>>
a is an instance of class int
as for widgets:
>>> import tkinter
>>> root = tkinter.Tk()
>>> type(root)
<class 'tkinter.Tk'>
>>> label_a = tkinter.Label(text='abc')
>>> type(label_a)
<class 'tkinter.Label'>
>>> # If you want to see methods and attributes for Label:
>>> help(tkinter.Label)
...
here are some tutorials on classes:
Class Basics
Class Intermediate: Inheritance
Class Intermediate: Operator Overloading
Classes [advanced]: Dependent attributes (and Descriptors)
Classes [advanced]: Descriptors (managed attributes)
Reply


Messages In This Thread
RE: Help me understand this... (Classes and self). - by Larz60+ - Mar-22-2019, 11:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to understand classes menator01 7 3,478 Oct-27-2019, 04:26 PM
Last Post: menator01
Question Helping understand classes Miraclefruit 10 6,536 Nov-27-2017, 01:58 PM
Last Post: Windspar
  Using classes? Can I just use classes to structure code? muteboy 5 5,236 Nov-01-2017, 04:20 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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