简体   繁体   English

带有2个GUI的P4a Kivy相机

[英]P4a Kivy Camera with 2 GUI

I'm a newbie here, so please, be gentle. 我是新手,所以请温柔。 I'd like to use the kivy built-in android camera, so that after taking the picture, I'd like to use another GUI. 我想使用kivy内置的Android相机,所以在拍完照片后,我想使用另一个GUI。 The app runs well on Ubuntu, but no camera. 该应用程序在Ubuntu上运行良好,但没有相机。 When I package it, it is successful, but after installing it immediately crashes. 当我打包它,它是成功的,但安装后立即崩溃。

Here is a snippet: 这是一个片段:

import kivy
from PIL import Image
from math import trunc
from PIL.ExifTags import TAGS
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from kivy.uix.floatlayout import FloatLayout


Builder.load_string("""
<CAM_GUI>:
    BoxLayout:
        orientation: 'vertical'
        Camera:
            id: camera
            resolution: (960, 1280)
            play: False
        Button:
            text: 'Shoot!'
            on_press: root.shoot()
            size_hint_y: None
            height: '48dp'
<GUI>:
    BoxLayout:
        orientation: 'vertical'
        padding: 10
        spacing: 10
        BoxLayout:
            orientation: 'horizontal'
            Image:
                id: 1.A
                source: 'checks.png'
            Image:
                id: 1.B
                source: 'checks.png'
            Image:
                id: 1.C
                source: 'checks.png'
        BoxLayout:
            orientation: 'horizontal'
            Image:
                id: 2.A
                source: 'checks.png'
            Image:
                id: 2.B
                source: 'checks.png'
            Image:
                id: 2.C
                source: 'checks.png'
        BoxLayout:
            orientation: 'horizontal'
            Image:
                id: 3.A
                source: 'checks.png'
            Image:
                id: 3.B
                source: 'checks.png'
            Image:
                id: 3.C
                source: 'checks.png'
        BoxLayout:
            orientation: 'horizontal'
            Image:
                id: 4.A
                source: 'checks.png'
            Image:
                id: 4.B
                source: 'checks.png'
            Image:
                id: 4.C
                source: 'checks.png'
        BoxLayout:
            orientation: 'horizontal'
            Image:
                id: 5.A
                source: 'checks.png'
            Image:
                id: 5.B
                source: 'checks.png'
            Image:
                id: 5.C
                source: 'checks.png'
        BoxLayout:
            orientation: 'horizontal'
            Image:
                id: 6.A
                source: 'checks.png'
            Image:
                id: 6.B
                source: 'checks.png'
            Image:
                id: 6.C
                source: 'checks.png'
        BoxLayout:
            orientation: 'horizontal'
            Image:
                id: 7.A
                source: 'checks.png'
            Image:
                id: 7.B
                source: 'checks.png'
            Image:
                id: 7.C
                source: 'checks.png'
        BoxLayout:
            orientation: 'horizontal'
            Image:
                id: 8.A
                source: 'checks.png'
            Image:
                id: 8.B
                source: 'checks.png'
            Image:
                id: 8.C
                source: 'checks.png'
        BoxLayout:
            orientation: 'horizontal'
            Image:
                id: 9.A
                source: 'checks.png'
            Image:
                id: 9.B
                source: 'checks.png'
            Image:
                id: 9.C
                source: 'checks.png'
        BoxLayout:
            orientation: 'horizontal'
            Image:
                id: 10.A
                source: 'checks.png'
            Image:
                id: 10.B
                source: 'checks.png'
            Image:
                id: 10.C
                source: 'checks.png'
        Button:
            text: 'Javit!'
            on_press: root.main()
""")

class CAM_GUI(BoxLayout):
    def shoot(self):
        gui.clear_widgets()
        gui.add_widget(GUI(name='mainboxlayout'))


class GUI(BoxLayout):
    def main(self):
        pass

gui = BoxLayout(orientation='vertical')
gui.add_widget(CAM_GUI(name='camboxlayout'))

class checkApp(App):
    def build(self):
        return gui


if __name__=='__main__':
    app=checkApp()
    app.run()

Could you help me, please? 请问你能帮帮我吗? Thank you very much in advance! 非常感谢你提前! :) :)

Best Regards, 3wnj9u3 最诚挚的问候,3wnj9u3

ImportError: No module named PIL ImportError:没有名为PIL的模块

is somewhere near the end of the log. 在日志的末尾附近。 Put that package into requirements, package again and run then. 将该包放入需求中,再次打包并运行。

For better log (cleaner, shorter) use: 为了更好的日志(清洁,更短)使用:

adb logcat -c && adb logcat
<run app>
<app crashes>
Ctrl + C

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM