我想改变我在Tkinter中的按钮的字体大小,所以它不是那么小。有没有人有任何想法,我可以做什么,可能会有我期待的结果?为什么我需要这么多的文本来问一个问题,我可以用简单而简单的方式用较少的文字提问?!我试图改变我的字体大小,它仍然没有影响。我如何改变字体大小?
from Tkinter import *
from tkFont import *
class App:
def __init__(self):
guiWindow = Tkinter.Tk()
guiWindow.wm_title("FooBar")
# Creates a custom font
customFont = Font(size=18)
# code to add widgets will go here
buttonFrame = Frame()
# colors the "ChangeLicense" button
color = '#005DA6'
# tells licenseChange what to do
def openLicenseChange():
print('Change License')
#button properties
licenseChange = Button(guiWindow,
command=openLicenseChange,
bd=20, bg=color, font=customFont,
text="Change License")
buttonFrame.pack(side="top", fill="x")
guiWindow.mainloop()
app=App()
的可能的复制[如何更改tkinter中使用python的按钮和框架的字体和大小?](http://stackoverflow.com/questions/20588417/how-to-change-font-and-size-of-buttons-and-frame-in -tkinter-using-python) – Li357
我不明白这个问题。你的代码确实创建了一个大字体的按钮。你有什么问题?当我运行你的代码(并且添加'licenseChange.pack()'时,出现一个大的18pt按钮。 –