Код написан только частично, и пока делает только малую часть того что запланировано. Но так как я не разу не упаковывал py в apk, решил попробовать заранее и видимо не зря.
Собственно main.py:
[code python]from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.scrollview import ScrollView
import warnings
import string
from kivy.base import runTouchApp
from kivy.lang import Builder
from kivy.properties import ObjectProperty
z = []
class Container (GridLayout):
kukumber = ObjectProperty()
label_kukumber = ObjectProperty()
def uhu_text(self):
self.kukumber.text = ''
with open('pass.ddg', 'r') as pass_list:
ss = pass_list.readlines()
for i in range(len(ss)):
z.append(ss[i])
r = ' '.join(z)
#print(r)
self.label_kukumber.text = r
self.kukumber.text = ''
def add_pass(self):
if self.kukumber.text == '':
self.label_kukumber.text='Введите текст!'
else:
with open('pass.ddg', 'a+') as pass_list:
new_pass = self.kukumber.text
pass_list.seek(0.2) # перемещение курсора в конец файла
pass_list.write('\n ================== \n'+new_pass)
pass_list.close()
print(self.kukumber.text)
self.label_kukumber.text='Обновите экран'
class MyApp(App):
def build(self):
return Container()
if __name__ == '__main__':
MyApp().run()
[/code]
[code python]
<Container>:
rows:4
padding: 50
kukumber: text_input
label_kukumber: label
TextInput:
id: text_input
# size_hint: 1, 0.5
multiline: True
size_hint: 1,0.20
ScrollView:
do_scroll_x: False
do_scroll_y: True
Label:
id: label
text: 'sometext3543534534534535354345345'
size_hint_y: None
height: self.texture_size[1]
text_size: self.width - dp(10), None
#color: 0, 0, 0, 1
BoxLayout:
size_hint: 1,0.1
# anchor_x: 'left'
anchor_y: 'top'
Button:
# pos: 10, 100
# size: 200, 50
# size_hint: None, None
text: 'показать'
text_zize: 20
# size_hint_x: .1
# size_hint_y: None
#font_size: 40
on_release:
self.text = 'обновить'
root.uhu_text()
Button:
# pos: 10, 100
# size: 200, 30
# size_hint: None, None
text: 'добавить'
text_zize: 20
# size_hint_x: .1
#font_size: 40
on_release:
root.add_pass()[/code]
buildozer.spec
[app]
# (str) Title of your application
title = MyApp
# (str) Package name
package.name = myapp
# (str) Package domain (needed for android/ios packaging)
package.domain = org.test
# (str) Source code where the main.py live
source.dir = .
# (list) Source files to include (leave empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas,ddg
version = 0.1
requirements = python3,kivy,android
orientation = portrait
osx.kivy_version = 2.2.0
fullscreen = 0
android.archs = arm64-v8a, armeabi-v7a
android.allow_backup = True
mage_url =
[buildozer]
# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2
# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 1
# (str) Path to build artifact storage, absolute or relative to spec file
# build_dir = ./.buildozer
# (str) Path to build output (i.e. .apk, .aab, .ipa) storage
# bin_dir = ./bin