Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
565 views
in Technique[技术] by (71.8m points)

python - How to set the height of a textfield widget in KivyMD

How to set exactly not the maximum height, but the default height, that is, the vertical size of the widget? Шf you do exactly as with the width then nothing will work

question from:https://stackoverflow.com/questions/65886057/how-to-set-the-height-of-a-textfield-widget-in-kivymd

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I am not sure what you are asking. In KivyMD MDTextField is just a line with a hint_text(If you give). What do you mean by increasing the height of a line?

You can increase the font size of input like this.

        MDTextField:
            hint_text:"Enter UserName"
            pos_hint:{'center_x':.5,'center_y':.5}
            font_size:"36dp"

or are you looking for rectangle mode?

       MDTextField:
            hint_text:"Enter UserName"
            mode:"rectangle"
            pos_hint:{'center_x':.5,'center_y':.5}
            font_size:"18dp"

or you can use:

       MDTextFieldRect:
            hint_text:"Enter Name"
            pos_hint:{'center_x':.5,'center_y':.2}
            size_hint:1,None
            height:"50dp"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...