[Python] how to center Spinner in kivy

Discussão em 'Python' iniciado por Stack, Setembro 28, 2024.

  1. Stack

    Stack Membro Participativo

    I started learning kivy and stopped at the stage with .kv files. The block with Spining is stuck to the corner and I can't put it in the center

    //python file

    class MyApp(App):
    def build(self):
    Builder.load_file('widgets.kv')
    return countryLists()

    class countryLists(Widget):
    def countryList(self):
    return pd.read_csv('./data.csv')['Country'].tolist()

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


    // .kv file :

    Spinner:
    id: spinner1
    text: 'select country'
    values: root.countryList()

    font_size: 24
    bold: True
    pos_hint: {"center_x": 0.5, "center_y": 0.5}
    anchor: 'center'


    I tryed use anchor: 'center', tryed use BoxLayout, change pos_hint, nothing to work

    enter image description here

    Continue reading...

Compartilhe esta Página