The apk file made with buildozer does not start - python

Converting the main file.py in the apk using buildozer is successful, but for some reason my file does not run on the phone.
Here is my import:
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.lang import Builder
from kivy.uix.button import Button
from kivy.config import Config
from kivy.core.window import Window
from kivy.uix.image import Image
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.progressbar import ProgressBar
from kivy.uix.image import AsyncImage
import requests
from bs4 import BeautifulSoup
import urllib.request
import string
import httplib2
import os
import os.path
import shutil
import itertools
import random
from pyaspeller import YandexSpeller
import threading
As I read on the forums, the problem may be in beautifulsoup but I do not know how to solve this problem, please help me!
Here is my log:
(https://i.stack.imgur.com/VyyXO.jpg)

Related

How do I bind the on_press function to the button in my kv app using the python file

I have tried to create a layout with multiple rows, where you can count up and down. The count is displayed in the label next to the buttons.
It is a part of a larger layout and application.
I get the layout that I want, but nothing happens when I press the buttons.
I have watched a lot of videos and searched the internet and encountered the .bind but I still haven't fixed it. I have also tried to make changes in the 'def add' and 'def sub'. I am not sure the *args should be there, but if i remove it I get a Traceback: TypeError: Countdown.add() takes 1 positional argument but 2 were given
I hope you can help on my way :)
The python file:
from kivy.app import App
from kivy.core.window import Window
from kivy.graphics.context_instructions import Color
from kivy.graphics.vertex_instructions import Ellipse, Line, Rectangle
from kivy.metrics import dp
from kivy.uix.scrollview import ScrollView
from kivy.properties import (BooleanProperty, NumericProperty, ObjectProperty,
StringProperty)
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.uix.stacklayout import StackLayout
from kivy.uix.textinput import TextInput
from kivy.uix.widget import Widget
Window.clearcolor =(1,1,1,1)
class Countdown(GridLayout):
my_text = StringProperty("0")
count = 0
def __init__(self, **kwargs):
super().__init__(**kwargs)
for i in range(0,10):
self.cols = 3
self.btn1=Button(text="+")
self.btn1.bind(on_press=self.add)
self.add_widget(self.btn1)
self.btn2=Button(text="-")
self.btn2.bind(on_press=self.sub)
self.add_widget(self.btn2)
self.lb=Label(text=self.my_text, color=[0,0,0,1])
self.add_widget(self.lb)
def add(self,*args):
self.count +=1
self.my_text = str(self.count)
def sub(self, *args):
self.count -=1
self.my_text = str(self.count)`

filechooser in kivy without class

hi there i new in kivy iam learning without classes i want filechooser but any one tell me kivy filechooserIconView without class and not with kivy file only python file
from kivy.uix.button import Button
from kivy.app import runTouchApp
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.image import Image
from kivy.uix.gridlayout import GridLayout
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.uix.scrollview import ScrollView
from kivy.uix.textinput import TextInput
from kivy.uix.label import Label
from kivy.uix.filechooser import FileChooserIconView
a=GridLayout(cols=1)
def a1():
global b
global c
c.text=str(b.path)
b=FileChooserIconView(path='/storage/emulated/0/')
from functools import partial
c=Button(text='ok')
a.add_widget(c)
b.bind(on_release=a1)
a.add_widget(b)
runTouchApp(a)
Your code almost works, just a couple issues. First, you are binding on_release to the FileChooser, but I think you want that bound to the Button. Second, our a1() method must accept an argument (the button). Here is a modified version of your code with those changes:
from kivy.uix.button import Button
from kivy.app import runTouchApp
from kivy.uix.gridlayout import GridLayout
from kivy.uix.filechooser import FileChooserIconView
a=GridLayout(cols=1)
def a1(button): # handle required arg
global b
global c
c.text=str(b.path)
b=FileChooserIconView(path='/home/jra')
c=Button(text='ok')
a.add_widget(c)
c.bind(on_release=a1) # bind to button, not FileChooser
a.add_widget(b)
runTouchApp(a)

Displaying an MDList in my kivymd file doesn't work

I'm working on a project with python and kivymd and i want to display an MDList in my file kv (list.kv)
but it doesn't work , i don't know where is the problem !! any suggestions
this is main.py
from kivy.lang import Builder
from mysql.connector import Error
from baseclass.start import Start
from kivy.lang import Builder
from threading import Thread
from kivy.uix.screenmanager import Screen
from kivy.utils import get_color_from_hex
from spin_load import ProgressSpinner
from kivymd.color_definitions import colors
from kivy.uix.recycleview import RecycleView
from kivy.core.window import Window
from kivy.uix.recycleview import RecycleView
import mysql.connector
from kivymd.uix.menu import MDDropdownMenu
from kivy.properties import OptionProperty
from kivy.properties import ObjectProperty
from kivymd.uix.bottomsheet import MDListBottomSheet
from kivymd.uix.expansionpanel import MDExpansionPanel
from kivymd.uix.boxlayout import BoxLayout
from kivymd.uix.list import OneLineListItem
Window.size = (360, 600)
class Codebarre(Screen):
def on_start(self):
for i in range(20):
self.root.ids.container.add_widget(
OneLineListItem(text=f"Single-line item {i}")
)
class MyApp(MDApp):
def build(self):
self.theme_cls.primary_palette = "DeepPurple"
return Builder.load_file("main.kv")
MyApp().run()
and this is the file where i want to display the MDList
list.kv
#:import utils kivy.utils
<Codebarre>:
name: 'codebarre'
ScrollView:
MDList:
id: container ```
It turns out that the on_start() method was never called. A working version of main.py is below. I didn't change list.kv.
from kivy.lang import Builder
from threading import Thread
import kivy.clock
from kivy.uix.screenmanager import Screen
from kivy.utils import get_color_from_hex
from kivymd.color_definitions import colors
from kivy.uix.recycleview import RecycleView
from kivy.core.window import Window
from kivy.uix.recycleview import RecycleView
from kivymd.uix.menu import MDDropdownMenu
from kivy.properties import OptionProperty
from kivy.properties import ObjectProperty
from kivymd.uix.bottomsheet import MDListBottomSheet
from kivymd.uix.expansionpanel import MDExpansionPanel
from kivymd.uix.boxlayout import BoxLayout
from kivymd.uix.list import OneLineListItem
from kivymd.app import MDApp
from kivy.uix.stacklayout import StackLayout
Window.size = (360, 600)
class Codebarre(Screen):
def __init__(self, **kvargs):
self.app = MDApp.get_running_app()
super().__init__(**kvargs)
kivy.clock.Clock.schedule_once(self.build)
def build(self, *args):
for i in range(20):
self.ids.container.add_widget(
OneLineListItem(text=f"Single-line item {i}")
)
class MyApp(MDApp):
def build(self):
self.theme_cls.primary_palette = "DeepPurple"
Builder.load_file("list.kv")
return Codebarre()
MyApp().run()

Fps bar on Kivy apps not disabling on mac os

I used Config.set('modules', 'monitor', '') on one of my Kivy apps to get the fps bar, but I can't get it disabled now.
Kivy version -- 1.10.1
I've tried everything and checked every line of code but can't get it disabled. Also if I write a basic code with just
from kivy.app import App
from kivy.uix.button import Button
imports I still getting the fps bar. I even reinstalled the whole Kivy environment but still I have the fps bar.
These are all the imports that I used in my file which created all the problem.
import kivy
kivy.require("1.10.1")
# from kivy.config import Config
# Config.set('graphics', 'resizable', 0)
# Config.set('graphics', 'width', 500)
# Config.set('graphics', 'height', 300)
# Config.set('modules', 'monitor', '')
from kivy.metrics import *
from kivy.core.window import Window
Window.size = (sp(500), sp(300))
from kivy.app import App
from kivy.uix.label import Label
from kivy.graphics import Line, InstructionGroup, Color
from kivy.properties import ObjectProperty, Property
from kivy.core.audio import SoundLoader
from kivy.clock import Clock
from kivy.uix.screenmanager import Screen, ScreenManager, FadeTransition
from kivy.lang import Builder
import random as rnd
import time
This is the basic code.
from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
return Button(text='Hello World')
TestApp().run()
Output Image
From eyllanesc's comment I've found a fix to this problem in case anyone else gets into the same problem.
Note: Always create a backup of the file.
Go to this directory.
Windows: C:\Users\tito\.kivy\config.ini
macOS: /Users/tito/.kivy/config.ini
Linux: /home/tito/.kivy/config.ini
Open config.ini
Find
[modules]
monitor =
Delete monitor = and Save it.
If anything happens just delete the config.ini and Kivy will create a new one but all your configurations will reset.

How to simplify imports in Kivy

My starting code often looked like this:
import libs.apa_database
import inspect
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.scrollview import ScrollView
from kivy.properties import ObjectProperty, StringProperty, Property
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from kivy.uix.dropdown import DropDown
from kivy.uix.button import Button
from kivy.clock import Clock
So, I wondered if there were a way to reduce the clutter like this:
from system_assets import APADatabase, App, Clock
from layout_assets import App, BoxLayout, GridLayout, ScrollView
from screen_assets import ScreenManager, Screen, FadeTransition
from interface_assets import DropDow, Button,
The answer is "yes":
Create new Python files as a "folder" to hold your imports
Add the import statements to that Python file
Import the assets from that file
(Will update this Q with more detail when I have time.)

Categories

Resources