Chapter 11. Custom Widgets and Classes: 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
The World Music Mixing Expo is only a few weeks away. Your DJ friend is thrilled with the work you’ve done, but now he has a few extra requirements.
Just playing one track isn’t enough. To be useful, the program needs to be able to mix several tracks together at the same time. Each track needs its own graphical interface elements (or widgets).
How will you create the widgets for each track?
To play and control a single track, you created two widgets on the GUI: a check button to start and stop the track and a scale to change the volume. Then you added event-handling code to hook those widgets up to the sound system.


To play multiple tracks together, you just need more of the same. Each track will need its own set of widgets and its own event handlers to connect the widgets and the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access