Kivy error - 'NoneType' object has no attribute 'transition' help me

67 Views Asked by At
import kivy

kivy.require('2.1.0') # replace with your current kivy version !

from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.screenmanager import SlideTransition


fontName = 'NanumGaRamYeonGgoc.ttf'

class InputScreen(GridLayout, Screen):
    def __init__(self, **kwargs):
        super(InputScreen, self).__init__(**kwargs)
        self.cols = 2
        self.add_widget(Label(text='로그라인: ', font_name=fontName, font_size=40))
        self.logline = TextInput(multiline=False)
        self.add_widget(self.logliine)
        self.add_widget(Label(text='주제: ', font_name=fontName, font_size=40))
        self.plot = TextInput(multiline=False)
        self.add_widget(self.plot)

        layout = BoxLayout(orientation = 'vertical')
                

        naving = BoxLayout(size_hint_y=0.2)

        created = Button(text='이야기 만들기', font_name=fontName, font_size=30)
                

        created.bind(on_release=self.switch_created)
                

        naving.add_widget(created)
        layout.add_widget(naving)

        self.add_widget(layout)

    def switch_created(self, *args):
        self.manager.transition = SlideTransition(direction="right")
        self.manager.current = self.manager.previous()


class MyApp(App):
    def build(self):
        return InputScreen()

if __name__ == '__main__':
    MyApp().run()

What I'm trying to create is to get 'logline' and 'plot' input, and press the button to make the story appear on the next page.

First of all, I want to implement the next screen after receiving the "logline" and "plot" input, but I keep getting this error

'NoneType' object has no attribute 'transition'.

Can you solve this problem?

Thank you in advance for solving the problem. I'll take your advice.

I want this error solved.

1

There are 1 best solutions below

0
eten On

In the build function of the app, you need to create a ScreenManager and add widgets or screens to that ScreenManager.

class MyApp(App):
    def build(self):
        sm = ScreenManager()
        sm.add_widget(InputScreen(name='input'))
        return sm