12.07.2015 Views

Think Python - Denison University

Think Python - Denison University

Think Python - Denison University

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

xviiiContents17 Classes and methods 15917.1 Object-oriented features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15917.2 Printing objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16017.3 Another example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16117.4 A more complicated example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16217.5 The init method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16217.6 The str method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16317.7 Operator overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16317.8 Type-based dispatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16417.9 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16517.10 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16617.11 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16617.12 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16718 Inheritance 16918.1 Card objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16918.2 Class attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17018.3 Comparing cards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17118.4 Decks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17218.5 Printing thedeck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17218.6 Add, remove, shuffle and sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17318.7 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17418.8 Class diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17518.9 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17618.10 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17718.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17819 Case study: Tkinter 18119.1 GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18119.2 Buttons and callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18219.3 Canvas widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18319.4 Coordinate sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!