有人可以解释我的Kivy有什么问题吗?

时间:2018-07-27 22:54:57

标签: python kivy

我需要为智能手机创建一个程序。而我的.kv有麻烦!你们能帮我吗???我需要构建各种“可点击的”图像,例如切换屏幕到另一个屏幕等...

我需要使该应用看起来像这张照片

  
    
      
        

OBS:这些文本:“在屏幕1 >>转到屏幕2”仅用于测试。

      
    
  

但是当我尝试运行程序时,给我一个错误。

...
18:       BoxLayout:

19:       Button:

--> 20:   text: 'On SCREEN 1 >> Go to Screen 2'

21:       on_press: root.manager.current = 'screen2'

22:
...
Invalid data after declaration

我的.py

from kivy import Config
Config.set('graphics', 'multisamples', '0')
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.properties import ObjectProperty
from kivy.lang import Builder
Builder.load_file('screens.kv')

class Intro(ScreenManager):
pass

class Gerenciador(ScreenManager):
pass

class Menu(Screen):
pass

class Manager(ScreenManager):
pass

class Soller(App):
def build(self):
    return Gerenciador()

Soller().run()

My.kv

#:kivy 1.10.1
#:kivy 1.0
#:import kivy kivy
#:import win kivy.core.window

<Gerenciador>:
Intro:
name: 'intro'
Manager:
name: 'Manager'

<Intro>
Image:
id: image
source: 'intro.png'

<Menu>:
BoxLayout:
Button:
text: 'On SCREEN 1 >> Go to Screen 2'
on_press: root.manager.current = 'screen2'

Button:
text: 'On SCREEN 2 >> Go to Screen 3'
on_press: root.manager.current = 'screen3'

Button:
text: 'On SCREEN 3 >> Go to Screen 4'
on_press: root.manager.current = 'screen4'

Button:
text: 'On SCREEN 4 >> Go to Screen 5'
on_press: root.manager.current = 'screen5'

Button:
text: 'On SCREEN 5 >> Go to Screen 6'
on_press: root.manager.current = 'screen6'

Button:
text: 'On SCREEN 6 >> Go to Screen 7'
on_press: root.manager.current = 'screen7'

Button:
text: 'On SCREEN 7 >> Go to Screen 8'
on_press: root.manager.current = 'screen8'

Button:
text: 'On SCREEN 8 >> Go to Screen 9'
on_press: root.manager.current = 'screen9'

Button:
text: 'On SCREEN 9 >> Go to Screen 10'
on_press: root.manager.current = 'screen10'

Button:
text: 'On SCREEN 10 >> Go to Screen 11'
on_press: root.manager.current = 'screen11'

Button:
text: 'On SCREEN 11 >> Go to Screen 12'
on_press: root.manager.current = 'screen12'

Button:
text: 'On SCREEN 12 >> Go to Screen 13'
on_press: root.manager.current = 'screen13'

<Manager>:
id: screen_manager

screen_one: screen_one
screen_two: screen_two
screen_three: screen_three
screen_four: screen_four
screen_five: screen_five
screen_six: screen_six
screen_seven: screen_seven
screen_eight:   screen_eight
screen_nine: screen_nine
screen_ten: screen_ten
screen_eleven: screen_eleven
screen_twelve: screen_twelve

ScreenOne:
    id: screen_one
    name: 'screen1'
    manager: screen_manager

ScreenTwo:
    id: screen_two
    name: 'screen2'
    manager: screen_manager

ScreenThree:
    id: screen_three
    name: 'screen3'
    manager: screen_manager

ScreenFour:
    id: screen_four
    name: 'screen4'
    manager: screen_manager

ScreenFive:
    id: screen_five
    name: 'screen5'
    manager: screen_manager

ScreenSix:
    id: screen_six
    name: 'screen6'
    manager: screen_manager

ScreenSeven:
    id: screen_seven
    name: 'screen7'
    manager: screen_manager

ScreenEight:
    id: screen_eight
    name: 'screen8'
    manager: screen_manager

ScreenNine:
    id: screen_nine
    name: 'screen9'
    manager: screen_manager

ScreenTen:
    id: screen_ten
    name: 'screen10'
    manager: screen_manager

ScreenEleven:
    id: screen_eleven
    name: 'screen11'
    manager: screen_manager

ScreenTwelve:
    id: screen_twelve
    name: 'screen12'
    manager: screen_manager

0 个答案:

没有答案