For example, suppose that
Jukebox
is a new widget class that
you have created. It's probably best to have new widget
classes inherit from the Frame
class, so to Tkinter it acts like a frame, and you can
arrange other widgets such as labels, entries, and
buttons inside it.
You set the new widget's class name by passing the
name as the class_
attribute to
the parent constructor in your new class's constructor.
Here is a fragment of the code that defines the new class:
class Jukebox(Frame): def __init__(self, master): "Constructor for the Jukebox class" Frame.__init__ ( self, master, class_="Jukebox" ) self.__createWidgets() ...