Book Image

Panda3D 1.7 Game Developer's Cookbook

Book Image

Panda3D 1.7 Game Developer's Cookbook

Overview of this book

Table of Contents (20 chapters)
Panda3D 1.7 Game Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Making the user interface data-driven using XML


A common practice in user interface programming is the division of design and program logic. In this recipe you will learn how to use one of the XML processing API that comes as a part of the standard libraries of the Python runtime used by Panda3D.

Note

Different versions of Panda3D might use different versions of Python. Don't assume these versions to be compatible as they might introduce changes to the standard library. You can check the version of the included Python runtime by issuing the command ppython --version on the console prompt.

Getting ready

Before proceeding, you will need to follow the recipe Setting up the game structure found in Chapter 1 to have the proper project structure set and ready.

How to do it...

Complete the following tasks to create a data-driven user interface:

  1. Add a new source file to the project and name it GuiBuilder.py.

  2. Add the following code to GuiBuilder.py. GuiHandler is only a class stub. The following functions...