Skip to main content

the idea is inspired by PySimpleGui , to quickly create simple kivy apps

Project description

SimpleKivy

pip install simplekivy

Perfect versions:


simplekivy is built on kivy to write simple code faster

you can write kvlang and creat your own classes and widgets as kivy is flexible

the widgets are added only once via simpleKivyObject + [

#kv_widgets

]

Examples to test:


from simplekivy import SimpleKivy
s = SimpleKivy(title="test")
dp = s.metrics.dp
s + [
    (# floatlayout <=> ()
        {"size_hint": (1, None)},#<=> add the floatlayout kwargs
        s.Label(text="ffljwfe", pos_hint={"center_x":.5, "center_y":.5}),
        {"height":  dp(200)}, #kwargs as you want will be added 
    ),
    [ #boxlayout <=> []
        {"size_hint": (1, .5)},
        s.Button(text="gdddg"),
        s.Button(text="gdgdd")
    ],
    
 
]
from simplekivy import SimpleKivy

s = SimpleKivy(title="test app")

dp = s.metrics.dp
inp1 = s.TextInput(size_hint=(.5, None), height=dp(50), pos_hint={"center_x":.5})
inp1_button = s.Button(text="click", on_press=lambda x:print(inp1.text),
                    size_hint=(.5, None), height=dp(50),
                    pos_hint={"center_x":.5})

s + [
    (#floatlayout
        {"size_hint":(1, 1)},
        [#boxlayout
            {"orientation":"vertical", "size_hint":(1, None), "height":dp(200),
            "spacing":"60dp","pos_hint":{"center_y":.5}},
            inp1, 
            inp1_button])
]
from simplekivy import SimpleKivy
def on_enter(instance):
    print(instance.text)
    
s = SimpleKivy(title="test app")

ainput = s.TextInput(multiline=False,  size_hint=(1, None),
     height="50dp", pos_hint={"center_x":.5, "center_y":.7})

ainput.bind(on_text_validate=on_enter)

s + [
    [{"orientation":"vertical", "size_hint":(1, .4)},
    s.Label(text="hello world", halign="center"),
    s.Label(text="testo")],
    ({"size_hint":(.4, .6), "pos_hint":{"center_x":.5}},
        ainput
    )
]

you can also add kvlang string directly instead of using s.lang.Builder or kivy.lang.Builder

from simplekivy import SimpleKivy
s = SimpleKivy(title="test app", make_app=True)

def on_enter(instance):
    print(instance.text)
    
def btn_pressed():
    print(ainput.text)


#add a new method to app
s.myapp.btn_pressed = btn_pressed

KV_BTN = """

Button:
    text: "press me"
    size_hint:.4, .2
    pos_hint: {"center_x": .5, "center_y": .5}
    on_press:app.btn_pressed()
"""
ainput = s.TextInput(hint_text="type anything", multiline=False,  size_hint=(1, None),
     height="50dp", pos_hint={"center_x":.5, "center_y":.7})

ainput.bind(on_text_validate=on_enter)

s + [
    [{"orientation":"vertical", "size_hint":(1, .2)},
    s.Label(text="hello world", halign="center"),
    s.Label(text="testo")],
    ({"size_hint":(.4, .4), "pos_hint":{"center_x":.5}},
        ainput 
    ),
    ({"size_hint": (1, .4)},
        KV_BTN),
]

Hints


  • list => BoxLayout
  • tuple => FloatLayout
  • set make_app to False if you do not want to run the kivy App
s = SimpleKivy(make_app=False)
  • to reach the main App object do s.myapp
  • the more you understand kivy, the more you enjoy its flexibility

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

simplekivy-0.0.3.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

simplekivy-0.0.3-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file simplekivy-0.0.3.tar.gz.

File metadata

  • Download URL: simplekivy-0.0.3.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for simplekivy-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2157fdc4d0959d83a9b8467d52a565dbd9587606cd916b5db7e8c7d71d696eba
MD5 806223f137fca2ce4fff867d017321eb
BLAKE2b-256 6a33c10a50f5fda1832393f078748fdaabd0e37b201f5eb78648ef345b07d915

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simplekivy-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for simplekivy-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d0a939291515f3cd28328b600c29b4c7966ba94acebc31bdd61b5feadef72b94
MD5 491946dc5a24056220353cb0a8c0fb9e
BLAKE2b-256 00e7e74aca6390cb04a9eef7c49e7e571e6e5e19f76f60b0df547b2ca3a81e2f

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