Milan Skála
Milan Skála

Reputation: 1784

How to set font size of Entry in Tkinter

I am a newbie in Python and I would like to set font size in Entry widget. I tried to set parameter font=("Calibri",12), but nothing happened, font size is just like the default. Is there any way how to set it?

Edit:

from Tkinter import *

root = Tk()

EntryList = []
for i in range(81):

    EntryList.append(Entry(root,font=("Calibri",12),justify="center",width=6,bg="#1E6FBA",fg="yellow",disabledbackground="#1E6FBA",disabledforeground="yellow",highlightbackground="black",highlightcolor="red",highlightthickness=1,bd=0))
    EntryList[i].grid(row=i/9,column=i%9,ipady=14)     

root.mainloop()

Upvotes: 4

Views: 39492

Answers (4)

user11280712
user11280712

Reputation: 1

You could make a variable

from Tkinter import *
import tkinter.font

root = Tk()

EntryList = []
for i in range(81):
FontOfEntryList=tkinter.font.Font(family="Calibri",size=12)
EntryList.append(Entry(root,font=FontOfEntryList,justify="center",width=6,
bg="#1E6FBA",fg="yellow",disabledbackground="#1E6FBA",disabledforeground="yellow",
highlightbackground="black",highlightcolor="red",highlightthickness=1,bd=0))
EntryList[i].grid(row=i/9,column=i%9,ipady=14)     

root.mainloop()

Upvotes: 0

alexmosk25
alexmosk25

Reputation: 134

Use font=("Calibri 12") It works for me)

Upvotes: 4

Gerald Leese
Gerald Leese

Reputation: 415

class StartPage(tk.Frame):

    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
                            #---------RIGHT HERE----#
    entry1 = tk.Entry(self, font="Helvetica 20 bold", width=20)
    entry1.pack(pady=5, padx=5 )



app = project1()
app.mainloop()

Upvotes: -4

Ari
Ari

Reputation: 39

from Tkinter import *

root = Tk()

EntryList = []
for i in range(81):

EntryList.append(Entry(root, font = "Helvetica 44 bold",justify="center",width=6,bg="#1E6FBA",fg="yellow",disabledbackground="#1E6FBA",disabledforeground="yellow",highlightbackground="black",highlightcolor="red",highlightthickness=1,bd=0))
EntryList[i].grid(row=i/9,column=i%9,ipady=14)     

root.mainloop()

Upvotes: 3

Related Questions