我的代码点亮了一个 LED。这个程序在 Tkinter 中有效,但当我用 Kivy 编写它时它不起作用!!问题是什么?
kivy.py ==>
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
import requests
class MainWindow(Screen):
pass
class WindowManager(ScreenManager):
pass
kv = Builder.load_file("my9.kv")
class MyMainApp(App):
def build(self):
return kv
if __name__ == "__main__":
MyMainApp().run()
我的.kv==>
WindowManager:
MainWindow:
<MainWindow>:
name: "main"
GridLayout:
cols:1
Button:
text: "Submit"
TheRequest = requests.get('http://192.168.43.91/on')
错误 ==> 文件“/home/pi/Desktop/ali/my9.kv”,第 13 行,在 TheRequest = requests.get('http://192.168.43.91/on') NameError: name 'requests' is not定义的
慕森卡
相关分类