【发布时间】:2017-02-18 20:17:27
【问题描述】:
我有一个关于 Tkinter 按钮的问题: 我尝试设置三个不同的按钮,具有不同的字体大小,但创建的按钮都具有相同的字体大小 - 我放置的最后一个按钮的大小。
我该如何解决这个问题?多个按钮,不同的字体大小? 显然所有按钮不仅具有相同的字体大小,而且还具有相同的字体系列...
tk = Tk()
tk.wm_title("Knowledge")
frame = Frame(width=768, height=576, bg="", colormap="new")
frame.pack_propagate(0)
frame.pack()
b = Button(frame, text = "Text", compound="left", command=callback, highlightthickness=0, font = Font(family='Helvetica', size=20, weight='bold'), bd=0, bg ="white")
b.pack()
b.place(x=100, y=100)
a = Button(frame, text = "my", compound="left", command=callback, highlightthickness=0, font = Font(family='arial', size=24, weight='bold'), bd=0, bg ="white")
a.pack()
a.place(x=100, y=140)
c = Button(frame, text = "Know", compound="left", command=callback, highlightthickness=0, font = Font(family='Helvetica', size=18, weight='bold'), bd=0, bg ="white")
c.pack()
c.place(x=100, y=180)
tk.mainloop()
【问题讨论】: