我創建了4個按鈕是在Tkinter的默認字體一次更改爲四個按鈕字體。現在我決定所有四個按鈕都太小了。所以我想增加它們中字體的大小。
面臨的問題
我不希望添加的東西font=custom
其中custom=tkFont.Font(family='Helvetica',size='18')
在所有四個語句。
有沒有辦法做到這一點的整個框架,這些按鈕在那裏?
代碼
f = self.frame
custom = Font(family='Helvetica',size=15)
start = Button(f,text='START',command=self.startrunning)
start.pack(side="top")
stop =Button(f,text='STOP',command=self.stoprunning)
stop.pack(side="top")
lap = Button(f,text='LAP',command=self.endlap)
lap.pack(side='top')
reset = Button(f,text="RESET",command = self.reset)
reset.pack(side="top")
close = Button(f,text="QUIT",bg="black",fg = "red",command=self.quitwin)
close.pack(side="top")
請幫助我做一些捷徑來達到目標。如果沒有捷徑,請告訴我這個!
您可以創建一個名爲'buttons'的列表,這將更清晰 – jamylak 2013-03-21 09:38:34
先生。這會幫助我一次更改所有按鈕的字體嗎? – IcyFlame 2013-03-21 09:40:44
用'for'循環,是 – jamylak 2013-03-21 09:41:17