[Tips] Problems and solutions in the development of python + kivy

Contents of this article

As a reminder, I will describe the problems and solutions in developing the python application using kivy.

Environment (as of 04/04/2020)

OS:macOS Catalina 10.15.3 Version of python used by kivy: 3.6.5 (included in Kivy3.app) Version of python3 displayed by toolchain.py recipes: 3.7.1 (probably different) version of kivy: 1.10.1

Event: The version of kivy displayed in toolchain.py recipes is incorrect.

Event details

When I run toolchain.py recipes immediately after git clone kivy-ios, the version of kivy is displayed as 18f37ed6e29620ee53c2a7699e0e0894e06a7f91. To.

What's happening

The revision number of kivy ver1.11.1 (although not exactly the revision number) is displayed.

Solution

Since the version is solidly written in kivy-ios / recipes / kivy / __ init__.py, modify it (for example, 1.10.1).

Event: kivy cannot be executed (ʻimport XXX` cannot be executed)

Event details

ModuleNotFoundError: No module named'kivy._clock' is displayed

What's happening

It seems that cython has not been compiled (according to the error message).

Solution

I didn't understand the cause, but once I deleted all Kivy3.app and reinserted it, it didn't occur.

Event: kivy module cannot ʻimport`

Event details

Certain modules (eg kivy.uix.listview) cannot ʻimport`

What's happening

For some reason, the module is not stored in Kivy3.app.

Solution

Bring it from master. Just git clone`` https://github.com/nuigroup/kivy and copy the necessary files. If you copied Kivy3.app to ʻApplications, the copy destination is under /Applications/Kivy3.app/Contents/Resources/kivy`.

Event: _trigger_reset_populate cannot be used

Event details

I've deleted the error message, but I'm told that there is no _trigger_reset_populate item

What's happening

(Probably) ListView is no longer available.

Solution

Use RecycleView instead of ListView. There is a sample here [https://github.com/kivy/kivy/tree/master/examples/widgets/recycleview). self.rv.data is a list that has a dictionary type as an element, so if there are multiple types of values you want to display, you can store them in a dictionary type item and pass them in the same way as value.

Event: The default position of RecycleView is not at the top.

Event details

If you display RecycleView once, scroll a little, go back, and display RecycleView again, I want it to be displayed at the top, but it displays the scrolled location by default.

What's happening

abridgement.

Solution

Set scroll_y of RecycleView to 1. Now when you display RecycleView, the top is always displayed.

Event: Font settings are not reflected

Event details

Even if you set the default font according to the procedure of here, it is not reflected.

What's happening

I don `t really understand.

Solution

I couldn't help it, so I decided to change the settings in the Config file. Example)

myFont = './fonts/ipaexg.ttf'
Config.set('kivy', 'default_font', ['ipaexg', myFont, myFont, myFont])
Config.write()

See here for Config. Note that the default_font is listed in the graphics section, but it should be the kivy section (it is stated at the bottom that it has been moved from version 1.10.0 to the kivy section).

If you don't know the version of kivy, it's quick to check the config file in ~ / .kivy.

Recommended Posts

[Tips] Problems and solutions in the development of python + kivy
The story of Python and the story of NaN
Problems and solutions when asked for MySQL db in Python 3
Count the number of Thai and Arabic characters well in Python
Get the title and delivery date of Yahoo! News in Python
Check the behavior of destructor in Python
The result of installing python in Anaconda
The basics of running NoxPlayer in Python
In search of the fastest FizzBuzz in Python
Project Euler # 1 "Multiples of 3 and 5" in Python
Comparing the basic grammar of Python and Go in an easy-to-understand manner
Change the saturation and brightness of color specifications like # ff000 in python 2.5
Development and deployment of REST API in Python using Falcon Web Framework
Open an Excel file in Python and color the map of Japan
Output the number of CPU cores in Python
Summary of the differences between PHP and Python
Get the caller of a function in Python
Match the distribution of each group in Python
The answer of "1/2" is different between python2 and 3
View the result of geometry processing in Python
Specifying the range of ruby and python arrays
About the difference between "==" and "is" in python
Tips for hitting the ATND API in Python
Find the divisor of the value entered in python
Compare the speed of Python append and map
python development environment -use of pyenv and virtualenv-
Find the solution of the nth-order equation in python
The story of reading HSPICE data in Python
[Note] About the role of underscore "_" in Python
About the behavior of Model.get_or_create () of peewee in Python
Solving the equation of motion in Python (odeint)
Output in the form of a python array
About the * (asterisk) argument of python (and itertools.starmap)
A discussion of the strengths and weaknesses of Python
Continuation of multi-platform development with Electron and Python
Explanation of edit distance and implementation in Python
About problems and solutions of OpenPyXL (Ver 3.0 version)
plot the coordinates of the processing (python) list and specify the number of times in draw ()
Python scikit-learn A collection of predictive model tips often used in the field
I compared the speed of regular expressions in Ruby, Python, and Perl (2013 version)
Divides the character string by the specified number of characters. In Ruby and Python.
Examples and solutions that the Python version specified in pyenv does not run
Python scikit-learn A collection of predictive model tips often used in the field
Get the last element of the array by splitting the string in Python and PHP
Python and numpy tips
the zen of Python
Framework development in Python
Development environment in Python
Slackbot development in Python
"Linear regression" and "Probabilistic version of linear regression" in Python "Bayesian linear regression"
Experience the good calculation efficiency of vectorization in Python
The simplest Python memo in Japan (classes and objects)
Receive the form in Python and do various things
How to get the number of digits in Python
Calculation of standard deviation and correlation coefficient in Python
Problems and countermeasures in smartphone app game development Part 1
The process of installing Atom and getting Python running
Old openssl causes problems in various parts of python
○○ Solving problems in the Department of Mathematics by optimization
Python --Explanation and usage summary of the top 24 packages
[python] Get the list of classes defined in the module