godot-python-extension#

This project provides Python language bindings for the Godot game engine.

The bindings are implemented as a GDExtension that exposes Godot’s APIs and enables extension classes and scripts to be written in Python.

Source code for the project can be found here.

Documentation status

Full documentation is still in the process of being written. Please check back if anything is missing. You can also summit an issue or pull request to help out in completing the documentation.

Project status

This repository is a work in progress and should be considered experimental. It’s not yet production ready.

Please use version control with any project.

Issues can be reported here. Suggestions on improvement are also welcomed.

Example#

import godot
from godot import Vector2, Input

@godot.expose_script_class
class PythonSprite(godot.Sprite2D, expose_all_methods=True):
	'''A simple script to demonstrate Python support.'''

	message: str = godot.property(default = 'hello world! 🐍')
	speed: float = godot.property(default = 250.0)

	def _ready(self):
		print(self.message)

		self.texture = godot.load('res://icon.png')

	def _process(self, delta: float):
		self.global_position += Vector2(
				Input.get_axis('ui_left', 'ui_right'),
				Input.get_axis('ui_up', 'ui_down')
			) * self.speed * delta

License#

This project released under the MIT license, see the license.md file.

Contents#