以下代码有什么问题?
# Program to Show how to create a switch
# import kivy module
import kivy
# base Class of your App inherits from the App class.
# app:always refers to the instance of your application
from kivy.app import App
# this restrict the kivy version i.e
# below this kivy version you cannot
# use the app or software
kivy.require('1.9.0')
# Builder is used when .kv file is
# to be used in .py file
from kivy.lang import Builder
# The screen manager is a widget
# dedicated to managing multiple screens for your application.
from kivy.uix.screenmanager import ScreenManager, Screen
# You can create your kv code in the Python file
Builder.load_string("""
<ScreenOne>:
BoxLayout:
canvas.before:
Color:
rgba: (.4, .6, 9, 1) #(0,0,0,1)
Rectangle:
size: self.size
pos: self.pos
canvas:
Color:
rgba: (1, 1, 1,1)
RoundedRectangle:
size : self.width/2, self.height/3
pos : self.center_x - self.w
idth/4 , self.center_y - self.height/6
radius: [(40, 40), (40, 40), (40, 40), (40, 40)]
Button:
text: "Go to Screen 2"
background_color : 0, 0, 1, 1
on_press:
# You can define the duration of the change
# and the direction of the slide
root.manager.transition.direction = 'left'
root.manager.transition.duration = 1
root.manager.current = 'screen_two'
我是 kivy 的新手,在网上获得了这段代码,效果很好。我现在试图通过在其中放置一些画布和形状来更改它,但出现错误:
AttributeError: 'kivy.graphics.context_instructions.Color' object has no attribute 'fbind'
这是什么意思,我怎样才能再次改变它以实现我的目标,即放置我的 2 个矩形并在它们上面放置按钮?
LEATH
相关分类