简体   繁体   English

为什么在 kivy 样式文件中使用尖括号时会不断收到“无效语法”错误?

[英]Why do I keep getting an “invalid syntax” error when using angle brackets in kivy style file?

So I have been experimenting with kivy and I am watching videos that explain how to create a kivy style file.所以我一直在试验 kivy,我正在观看解释如何创建 kivy 样式文件的视频。 I have copied the code directly from the site, but I keep getting an "invalid syntax" error for my angle brackets?我已经直接从网站复制了代码,但我的尖括号一直出现“无效语法”错误? I don't understand why?我不明白为什么? I am using Python 3.7.我正在使用 Python 3.7。 And I'm writing everything in the Python idle.我正在用 Python 写所有东西。 Kivy has been installed without any issues. Kivy 已安装,没有任何问题。 I have tried spacing as well as deleting the brackets and then typing them in myself, but nothing is working.我尝试过间距以及删除括号,然后自己输入它们,但没有任何效果。 Any suggestions will be greatly appreciated.任何建议将不胜感激。 I am still new to programming so I do not know all the tricks of the trade.我对编程还是个新手,所以我不知道交易的所有技巧。

Here is the code (copied exactly):这是代码(完全复制):

<MyGrid>:
    Label:
        text: "Name: "

在python中,ident是4,而kivy语言是5,也许这是你的问题编辑:Ident是你按下tab键时留下的空格数,在大多数IDE中,它被设置为4。

使用'name: '代替"name: "

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

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