Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yousuf60/simplekivy
the idea is inspired by PySimpleGui , to quickly create simple kivy apps.
https://github.com/yousuf60/simplekivy
kivy library python python3 simplekivy ui
Last synced: 22 days ago
JSON representation
the idea is inspired by PySimpleGui , to quickly create simple kivy apps.
- Host: GitHub
- URL: https://github.com/yousuf60/simplekivy
- Owner: yousuf60
- License: mit
- Created: 2023-06-24T13:33:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-30T17:00:53.000Z (9 months ago)
- Last Synced: 2024-10-14T06:40:53.221Z (22 days ago)
- Topics: kivy, library, python, python3, simplekivy, ui
- Language: Python
- Homepage:
- Size: 442 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SimpleKivy
```bash
pip install simplekivy
```### Do not forget to install:
-------
* [kivy]("https://pypi.org/project/Kivy")
* [kivymd]("https://github.com/kivymd/KivyMD") `master branch is recommended`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:
-----```python
from simplekivy import SimpleKivy
s = SimpleKivy(title="test app")
dp = s.metrics.dpdef pressed(instance):
if text_input.text:
label.text = text_input.textbackground = """
BoxLayout:
canvas:
Color:
rgba: 0, 0, .9, .7
Rectangle:
pos: self.pos
size: self.size"""
text_input = s.STextInput(hint_text="type", size_hint=(.5, None), height=dp(60), pos_hint={"center_x":.5})
btn = s.SButton(text = "click", size_hint=(.4, .2), pos_hint={"center_x":.5, "center_y":.5}, on_press=pressed)
label = s.SLabel(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
)
]```
```python
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.SButton(text="left")
right = s.SButton(text="right")
screen = ScreenI(name=str(i))
left.on_press = screen.left
right.on_press = screen.right
scr[screen] = [{"orientation":"vertical"},s.SLabel(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
```python
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----