Getting Started#

Installation#

Installing rubato is simple. Make sure you have Python 3.10 or later installed, then run the following in a terminal:

$ pip install rubato

Note

We recommend installing python directly from python.org if you do not already have it.

On Windows and Mac, the dll files that SDL needs come pre-bundled with rubato, so you should be ready to go.

On Linux only, you’ll need to install them yourself:
$ pip install pysdl2-dll

Setting Up#

Once you’ve installed rubato, setting up a new project is easy. To create a new blank project, simply create a new python file (such as main.py) and type the following:

import rubato as rb

rb.init()

rb.init() initializes rubato. An optional dictionary argument passed into rb.init() can specify such things as window name and size, resolution, and more.

Note

Throughout our documentation, we assume that rubato is imported as rb. If you used from rubato import *, just delete the rb. prefix where needed.

Now that rubato is ready, add the following line of code to the end of the file:

rb.begin()

rb.begin() is the function that starts the rubato engine. Without it, rubato won’t know to begin the engine cycle, and your game won’t run. It is recommended to call rb.begin() at the bottom of your project file as in this example.

Now run your code in a terminal using python YOUR_FILENAME.py. If you see a white square window, congrats! You’re officially up and running with rubato.

Warning

When you are working with rubato, make sure to only call rubato functions after calling init() and before begin(). Note that any code placed after begin() wont run, because the function blocks the main thread.

Note

Code not working? It’s possible something went wrong during the dependency installation process. Check your terminal log for errors and reinstall rubato and the SDL dlls if necessary. You can also file a bug report here if something went wrong on our end.