Can anyone help me with this please...I'm new to kivy and I had developed an app using python's kivy framework. In which I had used xlsxwriter for creating excel file. But the perplexing thing is when I run it on my windows that excel file is created and gets automatically saves down into the local python containing folder in the name which I give it as an text input. But unfortunately when I built it as an app using buildozer through google colab its not working. I mean the app is working but when I click on the save button then nothing happens. I had searched for the excel file in all over my file browser of my mobile. But its no where...
Can anyone help me to solve this issue. And thanks in advance...
Here's the 'main.py' python file:
from kivy.app import App
from kivy.properties import StringProperty
from kivy.uix import label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.popup import Popup
import xlsxwriter
class Boxlayoutexam(BoxLayout):
my_text=StringProperty('Data Acquisition to be started')
def on_button_click(self):
self.my_text='Data Acquisition started'
class StartPopup(Popup):
def on_yes_button_click(self):
my_textinput = self.ids.my_textinput.text
workbook= xlsxwriter.Workbook(my_textinput+'xlsx')
worksheet=workbook.add_worksheet('Diabetic Data')
workbook.close()
class myapp(App):
pass
myapp().run()
And here's the 'myapp'.kv kivy file:
#:import Factory kivy.factory.Factory
Boxlayoutexam:
<YesPopup@Popup>:
auto_dismiss: True
title: 'FILE SAVED'
size_hint:0.6,0.6
BoxLayout:
orientation:'vertical'
Image:
source: "greentick.png"
allow_stretch: True
size_hint:1.0,0.7
Label:
text: 'YOUR FILE GOT SAVED!'
font_size: 24
size_hint:1.0,0.3
<StartPopup@Popup>:
auto_dismiss: False
title: 'SAVE THE FILE'
size_hint:0.6,0.6
GridLayout:
cols:1
Label:
text:'Do you want to save the file?'
font_size: 24
size_hint:1.0,0.5
TextInput:
id: my_textinput
size_hint:1.0,1.0
font_size: 30
multiline: False
BoxLayout:
Button:
text:'YES'
font_size: 24
size_hint:1.0,1.0
on_press: Factory.YesPopup().open()
on_press: root.on_yes_button_click()
Button:
text:'NO'
font_size: 24
size_hint:1.0,1.0
on_release: root.dismiss()
<Boxlayoutexam>:
orientation:'vertical'
Label:
text:'Real time data acquistion'
size_hint:1.0,0.8
Label:
text:root.my_text
size_hint:1.0,0.1
Button:
text:'START'
font_size:30
size_hint:1.0,0.2
on_press:root.on_button_click()
on_release: Factory.StartPopup().open()
For providing path to save here's a minimal reproducible example
import xlsxwriter
work = xlsxwriter.Workbook('//storage//emulated//0//one.xlsx')
work.add_worksheet()
work.close()
And to add
MANAGE_EXTERNAL_STORAGE
Line 96 in buildozer spec
android.permissions = MANAGE_EXTERNAL_STORAGE