2013-06-28 58 views
1

我是Python中的新手,我想在Entry小部件中設置字體大小。我試圖設置參數font=("Calibri",12),但沒有發生任何事情,字體大小就像默認。 有沒有辦法如何設置它?如何設置Tkinter中Entry的字體大小

編輯:

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() 
+2

告訴我們在哪兒youre設法它 – Serial

+0

我不明白它的代碼。現在它工作正常。我剛剛刪除了字體參數,運行腳本,結束腳本,按Ctrl + Z,再次運行腳本,這很好...無論如何代碼示例是在編輯 –

回答

0
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() 
-2
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() 
+1

修復代碼縮進。更好的是,只需解釋如何在'tk.Entry()'中使用'font'參數 –