zoukankan      html  css  js  c++  java
  • Tkinter 字体类型

    转载:https://blog.csdn.net/hepu8/article/details/88833912

     1 # -*- coding: utf-8 -*-
     2 import tkinter as tk  #装载tkinter模块,用于Python3
     3 import  tkinter.font   as  tkFont  #导入Tkinter字体模块
     4 
     5 root=tk.Tk()  #创建Tkinter主窗口
     6 root.title("Tkinter字体演示")
     7 
     8 helv36 = tkFont.Font ( family="Helvetica",size=36, weight="bold",slant= "italic"  ,underline=1) #创建字体对象
     9 w = tk.Label(root, text="Tkinter字体演示", font=helv36) #创建Labkel部件 
    10 w.pack()  #放置部件
    11 
    12 f = tkFont.Font(family="times", size=30, weight="normal",slant= "roman",overstrike=1 )
    13 w = tk.Label(root, text="Hello, world", font=f)
    14 w.pack()
    15 
    16 w = tk.Button(root, text="Quit!", command=root.destroy)
    17 w.pack()
    18 
    19 fb = tkFont.Font(font=w["font"]).copy()
    20 fb.config(weight="bold")
    21 fb.config(size=20)
    22 w.config(font=fb)
    23 
    24 root.mainloop()

  • 相关阅读:
    杭电2042
    杭电2041
    杭电2040
    杭电2046
    SPOJ
    SPOJ
    SPOJ
    HDU
    HDU
    HDU
  • 原文地址:https://www.cnblogs.com/linbo3168/p/15320793.html
Copyright © 2011-2022 走看看