tkinter resizable text with grid

lizhollinshead5 at gmail.com lizhollinshead5 at gmail.com
Mon Dec 10 14:26:03 EST 2018


On Thursday, 6 December 2018 07:02:50 UTC, Paulo da Silva  wrote:
> Hi!
> 
> Does anybody know why this code does not expand the text widget when I
> increase the window size (with mouse)? I want height and width but as
> minimum (or may be initial) size.
> 
> import tkinter as tk
> 
> class App:
> 	def __init__(self,master):
> 		self.tboard=tk.Text(master,height=40,width=50)
> 		self.tboard.grid(row=1,column=1,sticky="nsew")
> 		self.tboard.grid_rowconfigure(1,weight=1)
> 		self.tboard.grid_columnconfigure(1,weight=1)
> 
> root=tk.Tk()
> app=App(root)
> 
> root.mainloop()
> 
> Thanks

Others here have commented about Tkinter.  I'm not a professional programmer, and I struggled with Python2 and Tkinter for a while.  It worked, but it was a struggle.
*
A few years ago I started using Glade and Python3 (and gi.repository).  Much easier, much less Python code, much easier to maintain.
*
Not that I'm much of a critic of Tkinter, just that the alternative is simpler and easier.


More information about the Python-list mailing list