最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - How to delete margins or spaces or padding between text vertically in flets - Stack Overflow

programmeradmin2浏览0评论

I have 2 Text() inside page.control, then I run it but I found margin/distance between Text(), I want to remove it

code

from flet import *
def main(page: Page):
    page.controls = [
        Text("hello world"),
        Text("hello world")
    ]
    page.update()
app(main)

code and output:

I tried looking for a certain attribute but I was confused

I have 2 Text() inside page.control, then I run it but I found margin/distance between Text(), I want to remove it

code

from flet import *
def main(page: Page):
    page.controls = [
        Text("hello world"),
        Text("hello world")
    ]
    page.update()
app(main)

code and output:

I tried looking for a certain attribute but I was confused

Share Improve this question edited Jan 22 at 18:15 James Z 12.3k10 gold badges27 silver badges47 bronze badges asked Jan 19 at 5:38 KiueeukouKiueeukou 34 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You might want to delete spacing between Text() in flet as vertically, you can edit spacing using page.spacing to edit vertical spacing in flet

bellow is no spacing vertically:

from flet import *
def main(page: Page):
    page.spacing = 0
    page.controls = [
        Text("hello world"),
        Text("hello world"),
    ]
    page.update()
app(main)

bellow is spacing vertically but 300:

from flet import *
def main(page: Page):
    page.spacing = 300
    page.controls = [
        Text("hello world"),
        Text("hello world"),
    ]
    page.update()
app(main)

Hope this helps!

发布评论

评论列表(0)

  1. 暂无评论