我在代码里使用ttkbootstrap中的Label和Button等,但是不懂怎么改变里面输入的text的字体大小,请问怎么改变?
2条回答 默认 最新
- CSDN专家-天际的海浪 2022-03-24 02:03关注
参考代码如下:
import ttkbootstrap as ttk from ttkbootstrap import Style as StyleBs if __name__ == "__main__" : root = ttk.Window() # 使用 ttkbootstrap 创建窗口对象 style = StyleBs("darkly") style.configure('TLabel', font=('Times New Roman', 40), foreground = "blue") # foreground is changed, but font is not style.configure('TButton', font=('Times New Roman', 30), foreground = "red") # foreground is changed, font too button = ttk.Button(root, style="TLabel", text="Label 12345" ).grid(row=0, column = 0) label = ttk.Label(root, style="TButton", text="Button 12345" ).grid(row=1, column = 0) root.mainloop()
如有帮助,请点击我的回答下方的【采纳该答案】按钮帮忙采纳下,谢谢!
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 5无用 3