I have a simple python kivy source code (only a example) and I execute the code in virtuelenv. The "program" runs without errors.
But unfortunately I see not the open window - only the Python Icon on the bottom from my task bar.
What I have to do that the windows opens?
# Datei: hello.py
import kivy
kivy.require('1.9.0') # Mindest-Version von Kivy
from kivy.app import App
from kivy.uix.button import Button
class HelloApp(App):
def build(self):
return Button(text='Hallo Welt!')
if __name__== "__main__":
HelloApp().run()
image
Related
When I run my kivy script,script runs without errors but I see no open window only a kivy icon in the task bar and it is not possible to open window.
This is a screenshot
This my code
from kivy.app import App
from kivy.uix.label import Label
class Test(App):
def build(self):
return Label(text='Hello
World',halign='center')
if __name__=='__main__':
Test().run()
I have a simple Kivy app to try out a clickable link opening a Web site. The code is:
kivy.require('1.9.0')
from kivy.app import App
from kivy.uix.label import Label
import webbrowser
class TestApp(App):
def build(self):
ref = '[ref=https://kivy.org/doc/stable/]' + 'Kivy documentation' + '[/ref]'
link = Label(text=ref, markup=True, on_ref_press=self.OpenLink)
return link
def OpenLink(self, label, ref):
webbrowser.open(ref)
if __name__ == '__main__':
TestApp().run()
When I run this app in the Kivy Launcher on Android, tapping the link works and opens the url in the browser. However, when I run the compiled app nothing happens when I tap the link.
In the buildozer.spec file I have:
android.permissions = INTERNET
According to all information I have been able to find, this is all I should need. What else am I missing?
I have tried logging the app using adb logcat but I can't see anything relating to the problem.
I am creating an application using Python Kivy that would take the user's input and create an Excel file storing the input.
I tried using openpyxl but the app crashes before starting on my android phone but on a desktop computer, it works perfectly. Is it possible to modify Excel files on my Android phone using Kivy and Openpyxl?
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
import openpyxl
class MyApp(App):
def build(self):
return MyGrid()
class MyGrid(GridLayout):
def __init__(self,**kwargs):
self.submit = Button(text='Submit', font_size=30)
self.submit.bind(on_press=self.pressed2)
self.add_widget(self.submit)
def pressed2(self,instance):
wb = openpyxl.Workbook()
ws = wb.active
ws['A1']='Hello'
wb.save('Trial.xlsx')
if __name__ == "__main__":
MyApp().run()
I use Kivy Launcher and the app crashes but if I remove all openpyxl stuff and put any other function, it works perfectly. I'm expecting it to create an Excel file on my phone. If this is not possible, what can I do instead?
It looks like it's probably a pure python library so it's likely to work without issues on Android, but you'll need to build an APK that actually includes it. It might also turn out that it does have dependencies that are hard to build for some reason, but you'll have to try it to see.
So i downloaded the "kivy" module (using the 'command prompt') as shown during this video "https://www.youtube.com/watch?v=B79miUFD_ss&list=PLGLfVvz_LVvTAZ-OcNIXe05srJRXaJRd9"
But whenever i try to run this code:
import kivy
kivy.require('1.9.0')
from kivy.app import App
from kivy.uix.button import Label
# Inherit Kivy's App class which represents the window
# for our widgets
# HelloKivy inherits all the fields and methods
# from Kivy
class HelloKivy(App):
# This returns the content we want in the window
def build(self):
# Return a label widget with Hello Kivy
return Label(text="Hello Kivy")
helloKivy = HelloKivy()
helloKivy.run()
It says the module doesn't exist?
How do i find the path of this module (and other modules)?
my kivy simple hello world app is not closing I'm using raspberry pi B and I can't close it I must unplug my raspberry pi 5v adapter to close it
I'm using rasbian jessie
this is the very simple code
import kivy
from kivy.app import App
from kivy.uix.label import Label
class mamdouh(App):
def build(self):
return Label(text='mamdouh')
if __name__=='__main__':
mamdouh().run()
What I was trying to say in the comment was. That you need to have some action to cause the quit, as the run method will run in a loop indefinitely otherwise.
If you now click on the Button labeled 'paul' it will quit.
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.button import Button
class mamdouh(App):
def build(self):
lbl = Label(text='paul')
btn = Button(text='mamdouh')
btn.bind(on_press=lambda b: app.stop())
lbl.add_widget(btn)
return lbl
if __name__ == '__main__':
app = mamdouh()
app.run()
I know nothing about kivy but I can see that this should allow you to quit, whether you want a Button in your app is another question.
Another way to kill it and avoid the reboot is simply to go back to the prompt where you launched your app and do CTRL + C. This will only work from the prompt though, not from the app window itself.