white square instead of the image.

1,545 views
Skip to first unread message

sergen

unread,
May 27, 2016, 5:56:03 PM5/27/16
to Kivy users support

I can't make viewing of images. The program normally works, the way to the image sees, but instead of the picture shows a white square. Picture size 35 Kbyte. On the computer the image is shown, on the tablet - a white square. Though earlier (everything worked at old versions of the Kivy and python-for-android ). The program doesn't give any error messages
I apply a code of the program, and also a zip archive with files

sergen@sergen-pc:~/PythonExp/kivy_exp/picture_viewer$ python /home/sergen/PythonExp/kivy_exp/image_view/main.py
[INFO   ] [Logger      ] Record log in /home/sergen/.kivy/logs/kivy_16-05-28_3.txt
[INFO   ] [Kivy        ] v1.9.1
[INFO   ] [Python      ] v2.7.11+ (default, Apr 17 2016, 14:00:29) 
[GCC 5.3.1 20160413]
[INFO   ] [Factory     ] 179 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[INFO   ] [GL          ] OpenGL version <3.0 Mesa 11.2.0>
[INFO   ] [GL          ] OpenGL vendor <nouveau>
[INFO   ] [GL          ] OpenGL renderer <Gallium 0.4 on NV84>
[INFO   ] [GL          ] OpenGL parsed version: 3, 0
[INFO   ] [GL          ] Shading version <1.30>
[INFO   ] [GL          ] Texture max size <8192>
[INFO   ] [GL          ] Texture max units <16>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [GL          ] NPOT texture support is available
[INFO   ] [GL          ] Unpack subimage support is available
[INFO   ] [Base        ] Start application main loop




#:kivy 1.9.1
#: import os os



<Root>:
GridLayout:
cols:1
raws:2
size_hint: None, None
size: root.size
spacing: 20
Button:
id: btn
size: root.size # пустая кнопка (бэкграунд)
disable: True
on_press: self.state = 'normal'
text: ''
Image:
id: img
source: ""


#!/usr/bin/env python
# -*- coding: utf-8 -*-
#:kivy 1.9.1

from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.label import Label
from os.path import join, exists
from kivy.uix.widget import Widget
from kivy.core.window import Window
import os
from kivy.uix.image import Image

from kivy import platform




class Root(Widget):

def __init__(self,directory, *args):
super(Root, self).__init__()
self.pth = directory
self.ids.img.source = join(self.pth,'image_1.jpg')
self.ids.btn.text = join(self.pth,'image_1.jpg')+u'\n'+ str(exists(join(self.pth,'image_1.jpg')))
class MyApp(App):

def build(self):
from kivy.base import EventLoop

if platform == 'linux':
Window.size = (800, 600)
pth =self.directory
return Root(pth)



if __name__ == '__main__':
MyApp().run()

title = <Image_viewer>
author = <Serg>
orientation = <portrait>

[app]

# (str) Title of your application
title = image_viewer

# (str) Package name
package.name = image_viewer

# (str) Package domain (needed for android/ios packaging)
package.domain = org.trade

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas, pyo

# (list) Source files to exclude (let empty to not exclude anything)
source.exclude_exts = spec

# (list) List of directory to exclude (let empty to not exclude anything)
source.exclude_dirs = tests, bin, fotos

# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg

# (str) Application versioning (method 1)
#version.regex = __version__ = ['"](.*)'['"]
#version.filename = %(source.dir)s/main.py

# (str) Application versioning (method 2)
version = 1.0

# (list) Application requirements
requirements = kivy 

# (list) Garden requirements
#garden_requirements =

# (str) Presplash of the application
#presplash.filename = /home/sergen/Картинки/path3837.png

# (str) Icon of the application
#icon.filename = /home/sergen/Картинки/Lime.png

# (str) Supported orientation (one of landscape, portrait or all)
orientation = portrait

# (bool) Indicate if the application should be fullscreen or not
fullscreen = 1


#
# Android specific
#

# (list) Permissions
#android.permissions = WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, ACCESS_CHECKIN_PROPERTIES, CAMERA,  EXPAND_STATUS_BAR

# (int) Android API to use
android.api = 17

# (int) Minimum API required (8 = Android 2.2 devices)
#android.minapi = 17

# (int) Android SDK version to use
android.sdk = 18

# (str) Android NDK version to use
#android.ndk = 9d

# (bool) Use --private data storage (True) or --dir public storage (False)
#android.private_storage = False

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
android.ndk_path = /home/sergen/Android/android-ndk-r9c/

# (str) Android SDK directory (if empty, it will be automatically downloaded.)
android.sdk_path = /home/sergen/Android/SDK_Android

# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
#android.p4a_dir = /home/sergen/python-for-android-master

# (list) python-for-android whitelist
#android.p4a_whitelist =

# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity

# (list) List of Java .jar files to add to the libs so that pyjnius can access
# their classes. Don't add jars that you do not need, since extra jars can slow
# down the build process. Allows wildcards matching, for example:
# OUYA-ODK/libs/*.jar
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar

# (list) List of Java files to add to the android project (can be java or a
# directory containing the files)
#android.add_src =

# (str) python-for-android branch to use, if not master, useful to try
# not yet merged features.
#android.branch = master

# (str) OUYA Console category. Should be one of GAME or APP
# If you leave this blank, OUYA support will not be enabled
#android.ouya.category = GAME

# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png

# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =

# (list) Android additionnal libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so
#android.add_libs_x86 = libs/android-x86/*.so
#android.add_libs_mips = libs/android-mips/*.so

# (bool) Indicate whether the screen should stay on
# Don't forget to add the WAKE_LOCK permission if you set this to True
android.wakelock = False

# (list) Android application meta-data to set (key=value format)
#android.meta_data =

# (list) Android library project to add (will be added in the
# project.properties automatically.)
#android.library_references =

#
# iOS specific
#

# (str) Name of the certificate to use for signing the debug version
# Get a list of available identities: buildozer ios list_identities
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"

# (str) Name of the certificate to use for signing the release version
#ios.codesign.release = %(ios.codesign.debug)s


[buildozer]

# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2


# -----------------------------------------------------------------------------
# List as sections
#
# You can define all the "list" as [section:key].
# Each line will be considered as a option to the list.
# Let's take [app] / source.exclude_patterns.
# Instead of doing:
#
#     [app]
#     source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
#
# This can be translated into:
#
#     [app:source.exclude_patterns]
#     license
#     data/audio/*.wav
#     data/images/original/*
#


# -----------------------------------------------------------------------------
# Profiles
#
# You can extend section / key with a profile
# For example, you want to deploy a demo version of your application without
# HD content. You could first change the title to add "(demo)" in the name
# and extend the excluded directories to remove the HD content.
#
#     [app@demo]
#     title = My Application (demo)
#
#     [app:source.exclude_patterns@demo]
#     images/hd/*
#
# Then, invoke the command line with the "demo" profile:
#
#     buildozer --profile demo android debug









image_view.zip

ZenCODE

unread,
May 28, 2016, 1:29:29 AM5/28/16
to Kivy users support
This is almost always because the image file is not there. Try writing the results of an os.listdir of self.pth to the log file and check if the image is there :-)

sergen

unread,
May 28, 2016, 4:28:29 PM5/28/16
to Kivy users support
This fact is known to me. Therefore for confirmation of presence of the file at the right place in the program there is such line :

self.ids.btn.text = join(self.pth,'image_1.jpg')+u'\n'+ str(exists(join(self.pth,'image_1.jpg')))

Module 'exists' checks is the file available in the directory. The result is displayed on the button 'self.ids.btn.text' .

The image is detected, but not displayed

суббота, 28 мая 2016 г., 8:29:29 UTC+3 пользователь ZenCODE написал:
Message has been deleted

sergen

unread,
May 30, 2016, 6:16:53 PM5/30/16
to Kivy users support
It occurs when I compile the APK by "buildozer android debug deploy". If I use "buildozer android_new debug deploy" the picture is displayed normally. But "android_new" can't be used in programs which use sqlite3 .

Kivy v1.9.1
Python v2.7.11+
Python-for-android  downloaded during compiling APK


суббота, 28 мая 2016 г., 8:29:29 UTC+3 пользователь ZenCODE написал:
This is almost always because the image file is not there. Try writing the results of an os.listdir of self.pth to the log file and check if the image is there :-)

sergen

unread,
Jun 8, 2016, 4:57:44 PM6/8/16
to Kivy users support
"os.listdir"  shows that the file is in the right place.

ZenCODE

unread,
Jun 21, 2016, 4:23:19 PM6/21/16
to Kivy users support
Try doing a webbrowser.open(file_name) just to check the file is not 0 bytes or corrupt?

sergen

unread,
Jun 29, 2016, 2:52:19 PM6/29/16
to Kivy users support
file is not zero because I can open it and see .

вторник, 21 июня 2016 г., 23:23:19 UTC+3 пользователь ZenCODE написал:
Message has been deleted

sergen

unread,
Oct 5, 2016, 5:27:55 PM10/5/16
to Kivy users support
One important note. The picture displayed in KivyLauncher 1.8.0 , but does not appear in KivyLauncher 1.9.1 .
I do not understand why !!??
Reply all
Reply to author
Forward
Message has been deleted
0 new messages