Skip to main content

bethany-lcl

Python bindings for the Lazarus LCL (Lazarus Component Library), with an API similar to C++Builder. Part of Bethany, which also provides the same API for C++ and a visual form designer for VS Code.

pip install bethany-lcl

The distribution name is bethany-lcl, and the module name is beth.

Preview. Bethany is at version 0.x. The API may change between minor versions. Only Windows x64 is supported for now.

Example

from beth import *


class TForm1(TForm):
    def __init__(self, AOwner):
        super().__init__(AOwner)
        self.Caption = "Hello"
        self.Button1 = TButton(self)
        self.Button1.Parent = self
        self.Button1.Caption = "OK"
        self.Button1.OnClick = self.Button1Click

    def Button1Click(self, Sender):
        self.Caption = "Clicked"


Application.Initialize()
Form1 = Application.CreateForm(TForm1)
Application.Run()

Classes, properties and events have the same names as in C++Builder and the LCL (TForm, TButton, Caption, OnClick and so on). The differences from C++ are:

  • Arguments passed by reference in C++ (int& Key, bool& CanClose, TCloseAction& Action, ...) are Ref objects. Read and write them with .value.
  • Application->CreateForm(&Form1) is Form1 = Application.CreateForm(TForm1).
  • Objects you create yourself (TStringList, TBitmap, TPicture, ...) are destroyed with Free(), or when no reference to them remains.
  • Using a wrapper after its LCL object has been destroyed raises ReferenceError.
  • Exceptions raised in the LCL are BethError (E.Message, E.ClassName()).

Designing forms

Bethany Designer is a VS Code extension to design forms on a canvas and generate the Python (or C++) code for them.

License

Bethany is distributed under the MIT License. The package contains beth.dll, which is built with Free Pascal and statically contains the Free Pascal run-time library and the LCL. They are distributed under the LGPL with a static linking exception. See THIRD-PARTY-NOTICES.md and the licenses folder in the package metadata, or the repository.

日本語

Lazarus の LCL を、C++Builder に似た API で Python から使うためのパッケージです。pip install bethany-lcl で入れ、from beth import * で使います。 今のところ Windows x64 だけに対応しています。C++ 版と、フォームを画面で設計する VS Code 拡張は Bethany のリポジトリを参照してください。

Metadata

Release files for bethany-lcl 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for bethany-lcl 0.1.1
File Interpreter ABI Platform Actions
bethany_lcl-0.1.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for bethany_lcl-0.1.1-py3-none-win_amd64.whl

Release files / bethany_lcl-0.1.1-py3-none-win_amd64.whl

Download URL bethany_lcl-0.1.1-py3-none-win_amd64.whl
Size 1.4 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
f9a85d3841771d243e0dc635656f584898ae690efa8ac4938e5dc817d863c7ae
BLAKE2b-256 checksum
How to use checksums
5ff85497d1a16695f576eb06d104fc4782c9dc8146e943747e6c8d40d8bb513b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Security for bethany-lcl 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page