Indentation error

Asked

Viewed 180 times

2

I’m trying to create a TextInput in the Kivy and define its dimensions, only whenever it puts its dimensions of error:

invalid indentation,must be a Multiple of 4 Spaces.

I still don’t understand why you’re making this mistake.

FloatLayout:

TextInput:
    size_hint:1., .5
    pos_hint{'x':.35,'y':.56}


Button:
    size_hint:.3,.1
    pos_hint:{'x':.35,'y':.1}
    text:'1'
Button:
    size_hint:.3,.1
    pos_hint:{'x':.35,'y':.5}
    text:'2'       
  • Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site

1 answer

1

Probably because you’re mixing spaces with tabs, they’re different characters. The error is quite clear, you used 4 spaces for indentation and should be so throughout the code. I can even almost guarantee that the first one has the wrong indentation, it must be a level up, but it may be that it was only wrong to post here. So I always say:

Enquanto você não souber o que cada caractere do seu código faz, até mesmo o espaço em branco, você ainda não sabe programar

Moral of the story: you need to learn everything from language, you need to understand the darkest details, you need to learn in a structured way.

  • 1

    True, I still can’t program and I’m practicing to learn. The problem was that I didn’t know that Textinput uses only one orientation compared to other widget in Kivy language. In python I can use Textiinput and other types of orientation. That’s why it gave error of endentation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.