The Finishing Touches – Sound and Animation

With our game now wearing its flashy graphical outfit, it's time to step it up one more notch on the scale of professionalism with some sound effects. These will help to engage the user by tapping into another of their senses.

To go along with the sound, we should also make some of the movement more realistic so that it better appears that our game is generating these noises.

Luckily, Tkinter's Canvas widget is well equipped to handle displaying animations and comes with some great built-in tools to make animating a breeze.

We can also take advantage of a popular Python game development library called pygame to make playing sounds incredibly simple.

By the end of this chapter, we will have covered the following:

  • Making graphics move on a canvas
  • Keeping control of the GUI while animations are playing
  • Integrating the pygame library with Tkinter and playing sounds
  • Expanding and re-structuring a larger application using Python's module system

With such a vast expansion of our application's features, it makes sense to try and abstract some of it into easily reusable chunks. We have already seen that defining classes can help to achieve this, but there is also one further step we can take – using Python's module system. Let's have a look into how this works before we begin refactoring our game.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset