Search code examples
python-3.xkivytextfieldmultilinekivymd

How to set fixed height of the MultilineTextField in KivyMD


  1. I am trying to set a fixed height for MDTextField:
MDTextField:
    id: 'feedback_text'
    hint_text: 'Description of the problem'
    multiline: True
    mode: 'rectangle'
    size_hint: None, None
    height: 200
    max_height: "200dp"
    pos_hint: {'center_x': .5, 'center_y': .35}
    size_hint_x: 0.8

But it doesn't work. I've try to set size_hint: None, None and height: 200 (200dp, '200dp') and it still doesn't work

  1. How to make the text field expand downwards, not vertically in all directions from the middle. Otherwise it goes to other widgets

Before

enter image description here

After

enter image description here

Environment

Win: 11

Python: 3.8

Kivy: 1.1.1

KivyMD: 1.2.0dev


Solution

  • I solved the problem by doing the following:

    MDTextField:
        id: feedback_text
        hint_text: 'Description of the problem'
        multiline: True
        mode: 'rectangle'
        size_hint_x: .8
        size_hint_y: .3
        pos_hint: {'center_x': .5, 'center_y': .25}