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 with kivy to write quickly simple codes

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

]

and you can build simplekivy way using s.build

Examples to test:


from simplekivy import SimpleKivy
s = SimpleKivy(title="test app")
dp = s.metrics.dp

def pressed(instance):
    if text_input.text:
        label.text = text_input.text

background = """
BoxLayout:
    canvas:
        Color:
            rgba: 0, 0, .9, .7
        Rectangle:
            pos: self.pos
            size: self.size

"""

text_input =  s.TextInput(hint_text="type", size_hint=(.5, None), height=dp(60), pos_hint={"center_x":.5})
btn = s.Button(text = "click", size_hint=(.4, .2), pos_hint={"center_x":.5, "center_y":.5}, on_press=pressed)
label =  s.Label(text = "type")

# you don't really need to build here and can just pass the list .. 
# but iam showing you how to get objets using s.build
# so you may need it somewhere else
front = s.build([{"orientation":"vertical"},
                text_input,
                (btn,),
                label            
])

s + [(background,
front
)
]
from simplekivy import SimpleKivy
s = SimpleKivy(title="test app")
screen_manager = s.ScreenManager()

class ScreenI(s.Screen):
    def left(self):
        print("------", self, self.name)
        screen_manager.transition.direction = "right"
        screen_manager.current = screen_manager.previous()

    def right(self):
        print("------", self, self.name)
        screen_manager.transition.direction = "left"
        screen_manager.current = screen_manager.next()

manager = {screen_manager: None}
scr = {}

for i in range(4):
    left = s.Button(text="left")
    right = s.Button(text="right")
    screen = ScreenI(name=str(i))
    left.on_press = screen.left
    right.on_press = screen.right
    scr[screen] = [{"orientation":"vertical"},s.Label(text=str(i)),[ left, right]]

manager[screen_manager] = scr
s + [
    manager
]

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
  • you can pass to s.build a list, tuple, dict, set and kivy lang string
  • 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.5.tar.gz (4.9 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.5-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simplekivy-0.0.5.tar.gz
  • Upload date:
  • Size: 4.9 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.5.tar.gz
Algorithm Hash digest
SHA256 6d24228802469b6a2d1ec99f003b359880b50a029e8d815b056ec7470620db56
MD5 588d26e07e7c061d5c3f4a942d49e7d2
BLAKE2b-256 6beee13eb3ce005010a9deee15116dc7246c5cb18c26fdff72d3b2ca316c0a3b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simplekivy-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.6 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6ed10cf8f9acd461fb62858190e3e00f3ce0df71000ada9749728e333d968596
MD5 3221a0664b622bff51f6c581f5ea7197
BLAKE2b-256 e1fcb47c33e477050934f77a8209c8ea8e3f1cbf75f500cae068809f05e748ef

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