Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kivy==master Window undefined #1687

Closed
RobertFlatt opened this issue Feb 7, 2019 · 1 comment
Closed

kivy==master Window undefined #1687

RobertFlatt opened this issue Feb 7, 2019 · 1 comment

Comments

@RobertFlatt
Copy link
Contributor

Versions

  • Python: 3.6
  • OS: Ubuntu 18.04
  • Kivy: master
  • Cython: 29.1

Description

Using python-for-android (master) downloaded 2/6/2019 (same with 2/2/2019)
Issue with kivy==master
This example crashes on Android load at main.py line 16
Log shows Window as NoneType object.

from kivy.app import App
from kivy.uix.label import Label
from kivy.graphics import Color, Rectangle
from kivy.core.window import Window

class Demo(App):
    def set_background_color(self):
        with self.label.canvas.before:
            Color(0.5, 0.0, 0.5)
            Rectangle(size=Window.size) 
       
    def _resize_handler(self,obj,size):
        self.set_background_color()

    def build(self):
        foo = Window.size                      ##### <<<<< Line 16
        Window.bind(size=self._resize_handler)
        self.label = Label(text = 'Greetings Earthlings')
        self.set_background_color()
        return self.label

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

buildozer.spec

Command:

1) Kivy==master produces crash:
p4a clean_all
p4a apk --requirements=python3,kivy==master

2) Kivy default produces no crash
p4a clean_all
p4a apk --requirements=python3,kivy

3) Kivy==master as a change to default (so no clean_all before) produces no crash
p4a apk --requirements=python3,kivy==master

.p4a file:

--dist_name=ex
--private .
--package=com.example.ex
--name Ex
--arch=armeabi-v7a
--orientation sensor
--sdk_dir /home/bobf/androidtools/sdk
--ndk_dir /home/bobf/androidtools/android-ndk-r17c
--android_api 28
--ndk-api 21
--version 0.0.0

Logs

02-06 13:01:54.057 26517 26548 I python  :    File "/mnt/c/users/bobf/documents/pm/tst2/main.py", line 16, in build
02-06 13:01:54.057 26517 26548 I python  :  AttributeError: 'NoneType' object has no attribute 'size'
02-06 13:01:54.057 26517 26548 I python  : Python for android ended.

@OptimusGREEN
Copy link
Contributor

These appear to be linked/same issue
kivy/kivy#6136

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants