简体   繁体   English

分离 kivy 和 py 文件时出现错误

[英]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.

相关问题 Python kivy从kivy文件中的* .py文件获取标签 - Python kivy get labels from *.py file in kivy file Kivy:在图像上运行.py文件onclick - Kivy : Run .py file onclick on image 如何访问 py 文件中的 kivy 按钮 ID? - How to access kivy button ids in py file? Kivy中build.py脚本的编译错误 - compilation error with the build.py script in Kivy kivy-ios.toolchain.py:第 4 行:语法错误:Mac High Sierra 中文件意外结束 - kivy-ios .toolchain.py: line 4: syntax error: unexpected end of file in Mac High Sierra 将 kivy 文件 (.py) 转换为 apk 时,小部件不会自动调整为设备的 window 大小 - When converting kivy file (.py) to apk, widgets are not automatically adjusting to device's window size 在 kivy 中如何导入一个 .py 文件以便在单击按钮时运行? 它说模块名称未定义 - How do you import a .py file so that it runs when a button is clicked in kivy? It says that the module name is not defined 导入 SMOTE 时出现不平衡学习模块 base.py 文件语法错误 - Imbalances-learn module base.py file syntax error coming up while importing SMOTE 将.py文件构建为.exe时导入错误 - Import error when building .py file to .exe Pyinstaller 尝试转换 py 文件时出错? - Error in Pyinstaller when trying to convert py file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM