Go to file
yumoqing 14ed661004 bugfix 2021-07-02 12:08:23 +08:00
docs bugfix 2021-03-22 00:37:42 +08:00
kivyblocks bugfix 2021-07-02 12:08:23 +08:00
readme bugfix 2021-02-03 18:12:12 +08:00
test bugfix 2021-03-16 11:11:15 +08:00
README.md bugfix 2021-03-17 12:01:37 +08:00
github-speed-up.md bugfix 2021-01-30 23:29:34 +08:00
requirements.txt bugfix 2021-01-31 17:37:28 +08:00
setup.py bugfix 2021-07-01 16:03:27 +08:00

README.md

KivyBlocks

Can you ever image build a gui application like play Lego blocks? kivyblocks just try to provide programmer a tool to build a application like play lego blocks

kivyblocks base on the python package 'kivy', which is a cross platform GUI package and can play on window, linux, mac OS x, android and iphone

Requirement

appPublic kivycalendar kivy ... see the requirements.txt

Principle

There is a BlocksApp(inherited from App) in kivyblocks contains a all widgets can be created by Blocks, and the Blocks creates widgets according a customized json data, the data can download from application server or local filesystem. The Customized json data has it own format to descript the UI and it's interaction. please see the "Customized json data" section for further information.

installation

pip install git+https://github.com/yumoqing/kivy-blocks

Use above command to install the newest version of kivyblocks

How to use

see the simple example below:

import sys
import os
from appPublic.folderUtils import ProgramPath
from appPublic.jsonConfig import getConfig

from kivyblocks.blocksapp import BlocksApp
from kivyblocks.blocks import Blocks

class TestApp(BlocksApp):
	def build(self):
		b = super(TestApp, self).build()
		widget_desc = {
			"widgettype":"VBox",
			"options":{},
			"subwidgets":[
				{
					"widgettype":"Title1",
					"options":{
						"text":"Say Hello",
						"i18n":True,
						"size_hint_y":None,
						"height":"py::CSize(2)"
					}
				},
				{
					"widgettype":"Text",
					"options":{
						"text":"Hello KivyBlocks"
					}
				}
			]
		}
		blocks = Blocks()
		x = blocks.widgetBuild(widget_desc)
		return x


if __name__ == '__main__':
	pp = ProgramPath()
	workdir = pp
	if len(sys.argv) > 1:
		workdir = sys.argv[1]
	print('ProgramPath=',pp,'workdir=',workdir)

	config = getConfig(workdir,NS={'workdir':workdir,'ProgramPath':pp})
	myapp = TestApp()
	myapp.run()

if you running it on window, it will show the following: hello

Documents

中文文档 English

references

Build app for android please see Buildozer kivy introduct and API please see kivy