Search code examples
pythonkivykivy-language

Kivy application on pc opening and instantly closing when run


When I open a kivy application it instantly closes. The terminal is in the picture below. Can not figure this out, cant find anything online about it so i would like is someone gave me some help

import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivy.uix.widget import Widget
from kivy.uix.floatlayout import FloatLayout
from kivy.properties import ObjectProperty
from kivy.lang import Builder




class MyLayout(Widget):
    pass



class MegaApp(App):
    def build(self):
        return MyLayout()

if __name__ == '__Main__':
    MegaApp().run()

kv file

<MyLayout>
    BoxLayout:
        orientation: 'vertical'
        size: root.width , root.height


        Label:
            text: "Enter Fahrenheit Below."
            font_size: 32

        TextInput:
            multiline: False
            size_hint: (1 , 0.5)

        Button:
            size_hint: (1, 0.5)
            font_size: 32
            text: "Submit"

terminal


Solution

  • Just a typo. Change:

    if __name__ == '__Main__':
    

    to:

    if __name__ == '__main__':