Expand Text widget to fill the entire parent Frame in Tkinter

前端 未结 3 1469
执念已碎
执念已碎 2021-01-01 15:45

I got this Text widget, and I\'d like for it to expand and fill its entire parent, using the Grid geometry manager.

According to the examples I\'ve seen

3条回答
  •  自闭症患者
    2021-01-01 16:30

    Since your window only contains one widget and you want this widget to fill the entire window, it would be easier to use the pack geometry manager instead of grid

    input_text_area.pack(expand=True, fill='both')
    

    expand=True tells Tkinter to allow the widget to expand to fill any extra space in the geometry master. fill='both' enables the widget to expand both horizontally and vertically.

提交回复
热议问题