[英]Error coming when seperating kivy and py file
I've just started learning Python with kivymd.我刚刚开始使用 kivymd 学习 Python。 I'm following kivymd example and I got problems.
我正在关注 kivymd 示例,但遇到了问题。
When I try to separate with py file and kivy file, The kivy file has an error with a red underline.当我尝试将 py 文件和 kivy 文件分开时,kivy 文件有一个带有红色下划线的错误。
Kivy files require #:kivy ! [1,1]
Here is the image of what I have a problem with.这是我遇到问题的图像。
Your lint tool is incorrectly telling you that you should write #:kivy some_version_number
at the top of your kv files.您的 lint 工具错误地告诉您应该在 kv 文件的顶部写入
#:kivy some_version_number
。 Either do that, or turn off/replace your linter, or put up with the false error.要么这样做,要么关闭/更换你的 linter,或者忍受错误的错误。
I am answering the second question (ie 'Do you know why this is?).我正在回答第二个问题(即'你知道这是为什么吗?)。 Seehttps://kivy.org/doc/stable/api-kivy.lang.html#module-kivy.lang where is states that "The content of the file should always start with the Kivy header, where version must be replaced with the Kivy language version you're using. ".
请参阅https://kivy.org/doc/stable/api-kivy.lang.html#module-kivy.lang其中声明“文件的内容应始终以 Kivy 标头开头,其中版本必须替换为您正在使用的 Kivy 语言版本。”。 So this appears to be a requirement and therefore means the lint tool is not incorrect.
所以这似乎是一个要求,因此意味着 lint 工具不正确。 Although, I had same question and believe it is a confusing requirement because the Kivy language version is not present in most examples.
虽然,我有同样的问题,并且认为这是一个令人困惑的要求,因为 Kivy 语言版本在大多数示例中都不存在。 Visual Studio Code always gives me the same error.
Visual Studio Code 总是给我同样的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.