Python Forum

Full Version: Help with code Kivy/Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone, I need a help, I do not understand why when I run the following code the screen appears only black. Can someone give me a hand?

I'm starting my first mobile software, I'm happy if you can help, thank you :D

from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.widget import Widget
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.image import Image
 
class Principal(App):
 
         def Build(self):
                  self.img1 = Image(source= "images/Logo.jpg",size_hint= (.5, .3),pos_hint={"center_x":.5, "center_y":.9}),
                  self.img2 = Image(source= "images/super.png",size_hint= (.99, .3), pos_hint={"center_x":.5, "center_y":.65}),
                  lb1 = Label(text="Usuário: ",font_size= '15sp',size_hint= (None,None),pos_hint= {"center_x":.40, "center_y":.43},bold= True),
                  lb2 = Label(text="Senha: ",size_hint= (None,None),font_size= "15sp",pos_hint={"center_x":.40, "center_y":.36},bold= True),
                  lb3 = Label(text="Cadatre-se!",size_hint= (None, None),font_size= "8sp",pos_hint= {"center_x":.5, "center_y":.3},bold= True),
                  lb4 = Label(text="Esqueceu sua senha?",size_hint= (None, None),font_size= "8sp",pos_hint= {"center_x":.5, "center_y":.32},bold= True)
 
                  layoutVideo = FloatLayout()
 
                  layoutVideo.add_widget(self.img1)
                  layoutVideo.add_widget(self.img2)
                  layoutVideo.add_widget(lb1)
                  layoutVideo.add_widget(lb2)
                  layoutVideo.add_widget(lb3)
                  layoutVideo.add_widget(lb4)
 
                  return layoutVideo
 
if __name__ == "__main__":
Principal().run()
Hello,
I'm kind of a kivy newb, but I saw a couple mistakes.
1 in the app class def build(self): (Not Build)
2 the commas after each widget needs to be deleted
example: self.img1 = Image(source= "images/Logo.jpg",size_hint= (.5, .3),pos_hint={"center_x":.5, "center_y":.9})
I was able to run it using other images good luck, Joe