Qpython - Kivy apps fail "No module named kivy" - kivy

I'm using Qpython v2.2.4-8 with python 2.7.12, and am trying to get a kivy app to run. I installed the pip libraries lxml-u4-qpython and kivy-u4-qpython via the app's terminal, and created a new sample kivy app which has this code by default:
#-*-coding:utf8;-*-
#qpy:2
#qpy:kivy
from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
# display a button with the text : Hello QPython
return Button(text='Hello QPython')
TestApp().run()
However, when I try to run the code, I get the exception ImportError: No module named kivy.app

I belive you need to add the line:
import kivy
at the beginning of your code in order for kivy to run.
I would like to hear your feedback if this actually was the problem or you already found out how it works

I don't think that Qpython comes installed with the kivy library. You can use another android application called pydroid3 . Kivy is already installed in the app, it also has some packages you might need. It can also run kivymd.

Related

Is it possible to override the behavior of tqdm.auto in a loaded library?

I am using an Emacs interface to Jupyter notebooks which means that even though tqdm detects that I am in a Jupyter notebook, I would like it to update the progress bar as if it were in a terminal (i.e. I use from tqdm import tqdm) in my Emacs interface.
However, some libraries (e.g. Huggingface) automatically detect whether or not I am in a notebook and use the specified tqdm progress bar. I would like to override this to use tqdm.std. Is this possible?
My current fix is to go into the source code and replace: #from tqdm.auto import tqdm with from tqdm import tqdm everywhere.

Issues making a wrapper Swift Package for Tidy-HTML5

So I'm trying to include Tidy-HTML5 into an app I'm making. I've run into some issue lately that I don't really know how to solve.
I created this wrapper package, since Tidy-HTML5 is a pure C library and does not support Swift Package Manager.
When I add this package as a dependency in my main project it works fine. That is I need to do the following:
import SwiftTidyHTML
import tidy
But this only works if I build for macOS, if I build for iOS I get an error that tidy cannot be found.
Any help would be really appreciated.
Thanks in advance.

Error message while trying to import TextAttack package

from textattack.augmentation import EasyDataAugmenter
I've just downloaded TextAttack package for Text Augmentation, however, I can't seem to be able to import the package. How can I solve this problem please?

My scikit learn machine learning kivy app crashes on android every time i try to run it can any one help me?

I have made a small kivy android app and run it on android using kivy launcher and all the buttons works fine without giving single error. But when I try to link my scikit learn machine learning model to a particular button then it starts to crash on android. I have my decision tree model that works fine with out any error and I saved it using pickel and the I loaded the saved model to my kivy app but it crashes when I try to run it on android using kivy launcher and also when I make the apk of this app it crashes too.
import pickle
model = pickle.load(open("prediction_model.sav", 'rb'))
def result(d):
value=model._predict(d)
if(value == 1):
return "your test is positive "
else:
return "your test is negative "
when I add these lines where my model make prediction on a particular data and it work fine when I run it on pycharm it dose not show any error and the same code crashes when I try to run it on android kivy launcher

Hyperlinks with ios recipe on kivy-ios

I'm trying to make a hyperlink that launches safari when clicked. I gather that this involves using iOS's native API, however I noticed in the kivy-ios package, there's a recipe called "ios" that seems to have this function built in.
I've not been able to google this successfully, maybe because searches for "kivy ios package" bring up the kivy-ios package which isn't what I'm looking for.
How can I use this and is there any documentation?
The source of the ios module is in the recipes/ios/src folder. It doesn't contain much so you can probably get what you need by just reading it.
You probably want the open_url function, which I think you can import as from ios.ios import open_url.

Resources