2016-10-29 1 views
1

Je suis un débutant ici, alors s'il vous plaît, soyez doux. Je voudrais utiliser l'appareil photo Android intégré kivy, de sorte qu'après avoir pris la photo, je voudrais utiliser une autre interface graphique. L'application fonctionne bien sur Ubuntu, mais pas de caméra. Quand je l'empaquette, c'est réussi, mais après l'installation, il plante immédiatement.P4a Kivy caméra avec 2 GUI

Voici un extrait:

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() 

Pourriez-vous me aider, s'il vous plaît? Merci beaucoup d'avance! :)

Cordialement, 3wnj9u3

+0

Coller journal de 'adb logcat', afin que nous puissions voir l'erreur de l'accident. – KeyWeeUsr

+0

Salut! Merci pour votre réponse! :) Je ne voudrais pas le coller ici, car il est un peu long, mais je donne un lien. :) [link] (https://www.dropbox.com/s/q1hee9wgwob6bwj/log.txt?dl=0) Merci pour votre temps et aide à l'avance! :) Cordialement, 3wnj9u3 – 3wnj9u3

Répondre

0

ImportError: No module named PIL

est quelque part près de la fin du journal. Mettez ce paquet dans les conditions, empaquetez encore et courez alors.

Pour un meilleur journal (plus propre, plus courte) utiliser:

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

Cher KeyWeeUser, Merci beaucoup, je ne savais pas PIL est sensible à la casse .. :) J'ai écrit PIL au lieu de PIL, il fonctionne maintenant en douceur! Merci pour votre temps, et passez une très belle journée! ;) Sincèrement, 3wnj9u3 – 3wnj9u3