Reputation: 256
The textfield does't expand to the size of textfield_frame = frame. Why? Later I want to place more widgets into more frames, that's why here i started with one frame inside the root frame. thanks in advance.
import Tkinter
root = Tkinter.Tk()
ScreenSizeX = root.winfo_screenwidth()
ScreenSizeY = root.winfo_screenheight()
FrameSizeX = int(ScreenSizeX * 0.7)
FrameSizeY = int(ScreenSizeY * 0.7)
FramePosX = (ScreenSizeX - FrameSizeX)/2
FramePosY = (ScreenSizeY - FrameSizeY)/2
root.geometry("%dx%d%+d%+d"%(FrameSizeX,FrameSizeY,FramePosX,FramePosY))
frame = Tkinter.Frame(root)
frame.pack()
textfield_frame_height = FrameSizeY
textfield_frame = Tkinter.Frame(frame,width=FrameSizeX,height=ScreenSizeY,bg="yellow")
textfield_frame.pack()
text = Tkinter.Text(textfield_frame)
text.pack(fill="both", expand=1)
root.mainloop()
Upvotes: 1
Views: 106
Reputation: 3205
Textfield
fits to textfield_frame
exactly. But textfield_frame
and frame
do not fit to root
:
frame.pack(fill="both", expand=1)
textfield_frame.pack(fill="both", expand=1)
Upvotes: 2