Home>

I am studying kivy in the book "Creating Apps in Kivy".

The sample programs that appeared in the book were as follows.

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
class AddLocationForm (BoxLayout):
    search_input = ObjectProperty ()
    def search_location (self):
        print (f "The user searched for {self.search_input.text}")
class WeatherApp (App):
    pass
if __name__ =='__main__':
    WeatherApp (). Run ()
AddLocationForm:
:
    orientation: "vertical"
    search_input: search_box
    BoxLayout:
        height: "40dp"
        size_hint_y: None
        TextInput:
            id: search_box
            size_hint_x: 50
        Button: Button:
            text: "Search"
            size_hint_x: 25
            on_press: root.search_location ()
        Button: Button:
            text: "Current Location"
            size_hint_x: 25
    ListView: ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥
        item_strings: ["Palo, Mx", "P, US"]

However, when I run it, I get "Unknown class".
When I looked it up, it seems that ListView is now obsolete and uses RycicleView as an alternative, but I don't know how to do it.

Could someone please tell me how to do that?

  • Answer # 1

    Why don't you refer to this? Because it looks like they are dealing with exactly the same code.