当前位置:网站首页>Mobile open source low code tools beeware and kivy
Mobile open source low code tools beeware and kivy
2022-08-04 10:02:00 【Leibniz infinity sml】
移动端 Open source low-code tools beeware 和 kivy
kivy
#anaconda3 @ win10
python --version
#Python 3.8.5
pip install virtualenv
python -m virtualenv kivy_venv
#若virtualenv 报错, 试试:#conda create python=3.8 -n kivy_venv
kivy_venv\Scripts\activate.bat
##: conda activate kivy_venv
python -m pip install "kivy[base]" kivy_examples
#Show examples
python kivy_venv\share\kivy-examples\demo\showcase\main.py
#centos 8 x64 stream @"win10x64 hyperv"
/home/z/python_root/Miniconda3-4.10.3/bin/activate kivy_venv
cd /home/z/
git clone https://github.com/kivy/buildozer.git
cd buildozer
sudo python setup.py install
cd /home/z/python_root/Miniconda3-4.10.3/envs/kivy_venv/share/kivy-examples/demo/
buildozer init
#安装buildozer所需依赖
#https://buildozer.readthedocs.io/en/latest/installation.html#targeting-android
buildozer android release
#编译***python***时, 报错 ctypes 找不到,
beeware
#构建好py虚拟环境
conda create python=3.8 -n beeware_venv
conda activate beeware_venv
pip install briefcase
briefcase new
#一路默认 novelz
#novelz/src/novelz/*.py
#如果要用pycharm 打开novelz/src/novelz/, 则应该安装: pip install toga==v0.3.0.dev35
#set JAVA_HOME=D:\jdk1.8.0_111
briefcase create android
briefcase build android
beeware win10 手动激活conda环境
可以在cmd.exe下, 执行 D:\Miniconda3\Scripts\activate.bat , 激活base环境. 再执行conda activate beeware_venv 激活bee
#打开一个cmdThe window implements the following:
D:\Miniconda3\Scripts\activate.bat
conda activate beeware_venv
echo %PATH%
#Manually find out the environment variablesPATH中beeware_venv的部分, 这就是下面 git bashmanually activatebeeware_venv的脚本
git bash 执行以下命令,手工激活 beeware_venv
beeware_env_path=/d/Miniconda3/envs/beeware_venv:/d/Miniconda3/envs/beeware_venv/Library/mingw-w64/bin:/d/Miniconda3/envs/beeware_venv/Library/usr/bin:/d/Miniconda3/envs/beeware_venv/Library/bin:/d/Miniconda3/envs/beeware_venv/Scripts:/d/Miniconda3/envs/beeware_venv/bin
export PATH=$PATH:$beeware_env_path
beeware create android 下载慢解决: github镜像、Change the download address to local
Python-3.8-Android-support.b5.zip The download address is changed to local
briefcase create android
#createThe step will be stuck on downloading https://briefcase-support.org/python?platform=android&version=3.8
# 手工下载 放到路径 /home/z/beeware_demo/Python-3.8-Android-support.b5.zip
#修改 /home/z/python_root/Miniconda3-4.10.3/envs/beeware_venv/lib/python3.8/site-packages/briefcase/commands/create.py : install_app_support_package 函数
#将
# support_package_url = app.support_package
#改成:
# support_package_url = "/home/z/beeware_demo/Python-3.8-Android-support.b5.zip"
#再次运行briefcase create android可以通过
briefcase-android-gradle-template.git Change to mirror address
#如果 它慢: "Using app template: https://github.com/beeware/briefcase-android-gradle-template.git, branch 3.8"
#修改 /home/z/python_root/Miniconda3-4.10.3/envs/beeware_venv/lib/python3.8/site-packages/briefcase/commands/create.py
""" @property def app_template_url(self): """The URL for a cookiecutter repository to use when creating apps.""" #return f"https://github.com/beeware/briefcase-{self.platform}-{self.output_format}-template.git" #The bank changed to github镜像加速地址:, can solve the slow problem return f"https://github.91chi.fun//https://github.com/beeware/briefcase-{self.platform}-{self.output_format}-template.git" """
beeware build android 错误解决
centos8stream x64下beeware build android报错: libssl.so not recognized as a valid object file
briefcase build android
#运行中
#The following error is reported:
""" /home/z/.briefcase/tools/android_sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip: error: '/home/z/beeware_weather/weather/android/gradle/weather/app/build/intermediates/merged_native_libs/debug/out/lib/x86_64/libssl.so': The file was not recognized as a valid object file /home/z/.briefcase/tools/android_sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip: error: '/home/z/beeware_weather/weather/android/gradle/weather/app/build/intermediates/merged_native_libs/debug/out/lib/x86_64/libcrypto.so': The file was not recognized as a valid object file """
#解决
cd /home/z/beeware_wth/wth/android/gradle/wth/app/build/intermediates/merged_native_libs/debug/out/lib/armeabi-v7a/
unlink libcrypto.so
unlink libssl.so
ln -s `pwd`/libcrypto1.1.so `pwd`/libcrypto.so
ln -s `pwd`/libssl1.1.so `pwd`/libssl.so
win10下 beeware build android报错 : utf8 codec can’t decode byte 0xd3
python --version
#Python 3.8.13
briefcase --version
#0.3.8
briefcase build android
#报错详情
""" > Task :app:compileDebugJavaWithJavac Exception in thread D:\weather\android\gradle\weather\gradlew.bat output streamer: Traceback (most recent call last): File "D:\Miniconda3\envs\beeware_venv\lib\threading.py", line 932, in _bootstrap_inner self.run() File "D:\Miniconda3\envs\beeware_venv\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "D:\Miniconda3\envs\beeware_venv\lib\site-packages\briefcase\integrations\subprocess.py", line 404, in _stream_output_thread print(popen_process.stdout.readline()) File "D:\Miniconda3\envs\beeware_venv\lib\codecs.py", line 323, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd3 in position 95: invalid continuation byte """
#解决办法:
export PYTHONIOENCODING=utf-8
beeware example
app.py
""" A simple weather app. """
from pprint import pprint
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW, LEFT, RIGHT
import httpx
TOKEN = "7eadee4312991c2935a8f9109645f19e" #Enter your weatherstack.com token here.
#http://api.weatherstack.com/current?access_key=7eadee4312991c2935a8f9109645f19e&query=New%20York
BASE_URL="http://api.weatherstack.com/current"
class weatherman(toga.App):
def startup(self):
""" Construct and show the Toga application. Usually, you would add your application to a main content box. We then create a main window (with a name matching the app), and show the main window. """
main_box = toga.Box(style=Pack(direction=COLUMN))
location_label = toga.Label("Location", style=Pack(padding=(0, 5)))
self.location_input = toga.TextInput(style=Pack(flex=1))
location_box = toga.Box(style=Pack(direction=ROW, padding=5))
location_box.add(location_label)
location_box.add(self.location_input)
weather_box_label = toga.Label("Weather Results", style=Pack(padding=(0, 5)))
self.weather_box_input = toga.TextInput(readonly=True, style=Pack(flex=1))
weather_box = toga.Box(style=Pack(direction=ROW, padding=5))
weather_box.add(weather_box_label)
weather_box.add(self.weather_box_input)
button = toga.Button("Fetch weather", on_press=self.weather, style=Pack(padding=5))
main_box.add(location_box)
main_box.add(button)
main_box.add(weather_box)
self.main_window = toga.MainWindow(title=self.formal_name)
self.main_window.content = main_box
self.main_window.show()
def weather(self, widget):
params = dict(access_key=TOKEN, query=self.location_input.value)
resp = httpx.get(BASE_URL, params=params).json()
try:
self.weather_box_input.value = f'The weather report for {
resp["request"]["query"]} \
{
resp["current"]["temperature"]} \
{
resp["current"]["weather_descriptions"][0]} \
{
resp["current"]["feelslike"]}'
except ValueError:
self.weather_box_input.value = "Location unknown!"
def main():
return weatherman()
pyproject.toml
[tool.briefcase.app.wth]
formal_name = "wth"
description = "My first application"
icon = "src/wth/resources/wth"
sources = ['src/wth']
requires = [
'httpx~=0.23.0' #这行是新增的, 因为app.pyused this library
]
cd /home/z/
mkdir /home/z/beeware_demo_wth
cd /home/z/beeware_demo_wth
briefcase new
#应用名为:wth
cd /home/z/beeware_demo_wth/wth/
vi /home/z/beeware_demo_wth/wth/src/app.py
#替换为上面app.py的内容
briefcase create android
#Watch out for slowness, Refer to the previous section
#将会创建android项目结构 :/home/z/beeware_demo_wth/wth/android/
briefcase build android
#会报错 libcrypt.so, libssl.so找不到, The solution has been written in the previous section. Copy here
cd /home/z/beeware_wth/wth/android/gradle/wth/app/build/intermediates/merged_native_libs/debug/out/lib/armeabi-v7a/
unlink libcrypto.so
unlink libssl.so
ln -s `pwd`/libcrypto1.1.so `pwd`/libcrypto.so
ln -s `pwd`/libssl1.1.so `pwd`/libssl.so
#再build一次即可
briefcase build android
#下载apk, Try it on your phone:
/home/z/beeware_demo_wth/wth/android/gradle/wth/app/build/outputs/apk/debug/app-debug.apk
边栏推荐
猜你喜欢
TCP协议 - 三次握手 - 四次挥手-内核参数调优
No module named 'flask_misaka' has been resolved [BUG solution]
HCIP 第十七天
MindSpore:【model_zoo】【resnet】尝试用THOR优化器运行时报cannot import name ‘THOR‘
【C补充】指向指针或函数的指针
物体颜色的来源
架构设计杂谈
Post-94 Byte P7 posted the salary slip: It's really good to make up for this...
被Win11安全中心误删除的文件怎么恢复?
LeetCode简单题之最好的扑克手牌
随机推荐
学习在php中分析switch与ifelse的执行效率
请问下Flink SQL如何写hologres分区表?我想要每天一个分区
【COS 加码福利】COS 用户实践有奖征文,等你来投稿!
Mysql应用日志时间与系统时间相差八小时
sqlilabs less-38~39
视频加密怎么播放_win播放器加密视频
HTB-Nibbles
用匿名函数定义函数_c语言最先执行的函数是
IDEA启动热部署
leetcode经典例题——56.合并区间
无代码平台多行文字入门教程
罗克韦尔AB PLC RSLogix5000中定时器指令使用方法介绍
Multimedia and Internet of Things technology make the version "live" 129 vinyl records "Centennial Voice"
张朝阳对话俞敏洪:谈宇宙、谈焦虑、谈创业、谈退休、谈人生
Qt:小的任务管理器(task)
No module named 'flask_misaka' has been resolved [BUG solution]
ps如何换背景颜色,自学ps软件photoshop2022,3种不同的方式笔记记录
Interview at 14:00 in the afternoon, I came out at 14:08 with my head down, asking too much...
二叉树的基础练习
请问同一个oracle cdc表,如果flink job重新提交,是会全量读取一遍源数据还是增量呢?