开发者

Tkinter text widget won't fill/expand

Ok so say I have a basic frame with text widget.

from Tkinter import *

app = Tk()

frame = Frame(app)
frame.pack()

text = Text(app)
text.pack(expand = 1, fill= BOTH)

If开发者_运维问答 I do this and start resizing the window the text widget will not expand with the window. It works with any other widget so what's going on with the text widget and what's the proper way to make it resize with the window?


Your exact code does expand for me when resized.

If you're writing on IDLE, then you might want to restart IDLE and/or test your program outside IDLE, especially if you're on Windows and IDLE is not using subprocess to connect to the child interpreter; IDLE often does not work well for writing Tkinter programs since IDLE itself is written in Tkinter.


Make the Frame fill as well. The frame line should have fill = BOTH as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜