Python
This plugin enables full access to Tellusim API from the Python programming language. It can also be used as an embedded scripting language via the System Python plugin. The plugin includes a comprehensive and user-friendly 3D math library designed for high-performance graphics development. It supports the Python buffer protocol, enabling efficient data interoperability with NumPy, PyTorch, and other Python libraries.
info
The plugins/binding/python/include
directory contains binding headers.
The plugins/binding/python/source
directory contains binding sources.
The target Python library is libTellusimPy
, which depends only on libTellusim
.
See Readme.txt for build and deployment instructions.
# create App
app = App(argv)
if not app.create(PlatformAny): return
# create Window
window = Window(app.platform, app.device)
if not window: return
window.setSize(app.width, app.height)
# set close callback
window.setCloseClickedCallback(lambda: window.stop())
# set keyboard callback
def pressed_callback(key, code):
if key == Window.KeyEsc: window.stop()
if key == Window.KeyF12:
image = Image()
if window.grab(image) and image.save('screenshot.png'):
Log.print(Log.Message, 'Screenshot\n')
window.setKeyboardPressedCallback(pressed_callback)
# create and show the window
title = window.platform_name + ' Tellusim::Python'
if not window.create(title, Window.DefaultFlags | Window.FlagVerticalSync) or not window.setHidden(False): return