Page 21 -
P. 21
table of contents
custom widgets and classes
10 With an object in mind
Requirements can be complex, but programs don’t have
to be.
By using object orientation, you can give your programs great power without
writing lots of extra code. Keep reading, and you’ll create custom widgets that do
exactly what you want and give you the power to take your programming skills
to the next level.
The DJ wants to play more than one track 350
Create code for each track as a function 351
The new function contains other functions 356
Your new function needs to create widgets and event handlers 357
The DJ is confused 362
Group widgets together 363
A frame widget contains other widgets 364
A class is a machine for creating objects 366
A class has methods that define behavior 367
But how does an object call a method? 369
The SoundPanel class looks a lot like the create_gui() function 370
class = methods + data 372
The Class Exposed 373
The DJ has an entire directory of tracks 378
It’s party time! 382
Your Programming Toolbox 383
Leaving town... 384
It’s been great having you here in Codeville! 384
xx