Skip to main content

An extension to Kivy's Label widget

Project description

RefLabel

RefLabel is written as an extension to Kivy's Label widget, with a focus on the [ref=] markup capability.

RefLabel automatically prepends items in its item list with [ref=] markers, and arranges them in a grid pattern before placing them in the text field of the label widget. RefLabel also inlcudes options and methods to accomodate this goal, which are explained in the source file.

Any item in the list that is already referenced will be left as is, where an item with [ref=None] will have its reference removed. Assignment of automatic references may be halted by setting the references variable to False.

Any instance method defined as ref_<name> will be executed if the matching referenced name in the label is selected.

Requires:

  • python3
  • kivy

Examples

from ftref import RefLabel

test = RefLabel(set_label=False)

test.cols = 3
test.rows = 3

test.items = ["One", "Two", "Three",
"Four", "Five", "Six",
"Seven", "Eight", "Nine"]

test.init()

print(test)
One Two Three
Four Five Six
Seven Eight Nine

print(test.text)
[ref=('One', 0)]One[/ref] [ref=('Two', 1)]Two[/ref] [ref=('Three', 2)]Three[/ref]
[ref=('Four', 3)]Four[/ref] [ref=('Five', 4)]Five[/ref] [ref=('Six', 5)]Six[/ref]
[ref=('Seven', 6)]Seven[/ref] [ref=('Eight', 7)]Eight[/ref] [ref=('Nine', 8)]Nine[/ref]

Change orientation:

test.orientation = 'lr-bt'
test.init()
print(test)
Seven Eight Nine
Four Five Six
One Two Three

refMethod decides between name or indicie upon selection:

test.refMethod = 'indicie'
test.selector(None, name=4, scope='items')
test.selected
[4]

test.clearselection()

test.refMethod = 'name'
test.selector(None, name=4, scope='items')
test.selected
['Five']

Selecting an item twice deselects it. Multiple selections can be made:

test.multi = True
test.selector(None, name=[4,5,6], scope='items')
test.selected
['Six', 'Seven']

Project details


Download files

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

Source Distribution

ftref-figTree-0.0.3.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ftref_figTree-0.0.3-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file ftref-figTree-0.0.3.tar.gz.

File metadata

  • Download URL: ftref-figTree-0.0.3.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.9

File hashes

Hashes for ftref-figTree-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5aa396c90520806b2664877bd35ab50ed0b2aa881f40b1f4ce16cde0803659c3
MD5 4de024d4b9a8da8c6207e3be31873a57
BLAKE2b-256 fba64cb857aedff114bb3917ae3116b0a09ff3821ae91039620e6b532d493122

See more details on using hashes here.

File details

Details for the file ftref_figTree-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: ftref_figTree-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.9

File hashes

Hashes for ftref_figTree-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 820f741504ba0fb4aaf16c31161c7aa6b23f5c09ce2782427b3dae8d48bcec52
MD5 923d05b9c31216a553bc30bf85899896
BLAKE2b-256 901290ea9ebb63f66afc6f947e56625ca06103035bfadc3aa55c62e44692874c

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