tkinter Entry height

jjguidry picture jjguidry · Apr 2, 2016 · Viewed 20.8k times · Source

I tried

textEntry = Entry(root, width=115, textvariable=text, height=12)

but I got an error invloving the height.

Then I tried using the Text widget:

textEntry = Text(root, width=115, textvariable=text, height=12)

but I got an error involving textvariable=text

Any way I could adjust the height of the Entry or the variable of the Text?

Answer

user5925113 picture user5925113 · Apr 2, 2016

To change an entry widget's size you have to change its font to a larger one.

For example:

import tkinter as tk

large_font = ('Verdana',30)
small_font = ('Verdana',10)

root = tk.Tk()

entry1Var = tk.StringVar(value='Large Font!')
entry1 = tk.Entry(root,textvariable=entry1Var,font=large_font)
entry1.pack()    

entry2Var = tk.StringVar(value='Small Font!')
entry2 = tk.Entry(root,textvariable=entry2Var,font=small_font)
entry2.pack()

root.mainloop()