O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

What just happened?

We created a class called QtPython that wraps the Python C API for us.

Never use a Q prefix to call your custom classes, as this prefix is reserved for official Qt classes. This is to ensure that your code will never have a name clash with future code added to Qt. The Qt prefix, on the other hand, is meant to be used with classes that are extensions to Qt. You probably still shouldn't use it, but the probability of a name clash is much smaller and yields a lesser impact than clashes with an official class. It is best to come up with an application-specific prefix or use a namespace.

The class constructor creates a Python interpreter, and the class destructor destroys it. We use Py_InitializeEx(0), which has the same functionality ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required