Skip to main content

Declarative tkinter layout engine with reactive data binding

Project description

Declarative tkinter UI with reactive data binding

Banner

Features

  • Drag and Drop support (tkDnD)
  • Supports async by default (powered by asyncio)
  • Two-way data binding
  • Flexible layout by design
  • Application scrolls automatically
  • Simple layout syntax powered by Pug (former Jade)
  • Widget parameter support inline python scripting
  • ttk themes included
  • Lightweight and fast
  • Add any custom tkinter widget

Designer

Installation

Make sure your python installation is 3.7 or higher.

You need the tk extension tkDnD for this framework. This can be automatically installed via pip argument. Make sure the python directory is writable (e.g. on Mac OSX, Python library are installed to /System/Library, which cannot be modified, even with sudo!).

pip install layoutx (minimal version)

pip install layoutx[more_widgets, styles] (full version)

python -m layoutx.install_tkdnd (install tkdnd)

The command line tool: lxdesigner can be used to easily design some forms.

For lxdesigner to function, you need to install addon more widgets.

Addons

Some dependencies of this project have a GPL v3 license. They are excluded into separate addons. Please note by installing these dependencies, you confirm to the GPL license agreement.

This project itself is licensed under MIT.

more widgets:

More information see: ttkwidgets Github

  • Input
  • ComboBox
  • TextArea
  • Scale

pip install layoutx[more_widgets]

ttk themes:

More information see: ttkthemes Github

pip install layoutx[styles]

Getting started

from layoutx        import app # Import the app singleton
from layoutx.store  import create_store
from layoutx.view   import View, ResizeOption

store = create_store({}, { "name": "World" })

class RootView(View):
  geometry = "250x50+100+100"
  title = "My first app"
  resizable = ResizeOption.NONE
  template = """\
ScrollFrame
  Box(orient="horizontal")
    Label Hello
    Input(value="{{name}}")
  Button(command="{say_my_name}") Say my name!
"""
  def say_my_name(self):
    print(self.store.state["name"])

if __name__ == "__main__":
  app.setup(store=store, rootView=RootView)
  app.run()

Getting Started

Documentation

Read the documentation for more information.

Project details


Release history Release notifications | RSS feed

This version

1.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

layoutx-1.2.tar.gz (176.8 kB view details)

Uploaded Source

File details

Details for the file layoutx-1.2.tar.gz.

File metadata

  • Download URL: layoutx-1.2.tar.gz
  • Upload date:
  • Size: 176.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

File hashes

Hashes for layoutx-1.2.tar.gz
Algorithm Hash digest
SHA256 ebe828c50f642b814dee9de4fe9ac2af1f4e2c1dada93cc5bbca59c8c551fa0a
MD5 1ac24e49ff1ae75d0723c26ffdbe81a4
BLAKE2b-256 4774cfb13148ad8b5b3adf7759e85049a505227b445e6f27c705ade4aa2330a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page