I am a beginner in Kivy. I was just writing a simple code when I got stuck, and when I am trying to run the code, the output screen is blank. Heres the code:
Python code:
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.metrics import dp
class MainWidget(Widget):
pass
class TheLabApp(App):
pass
TheLabApp().run()
Kivy code:
MainWidget:
<MainWidget>:
Button:
text: "Button"
size: "400dp", "200dp"
pos: "100dp", "200dp"
color: 0, 1, 1, 1
Label:
text: "Label"
size: "100dp", "80dp"
pos: "550dp", "300dp"
color: 1, 0, 0, 1
Try to build on this code.
import kivy
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
if __name__ == '__main__':
MyApp().run()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.