Tk - 字体组件

Tk - 字体组件 首页 / Tcl/Tk入门教程 / Tk - 字体组件

有许多支持显示文本的小部件。其中大多数提供字体属性选项。创建字体的语法如下所示-

font create fontName options

字体参数

下表中列出了可用于字体创建的选项-

Sr.No.Syntax & Remark
1

-family familyName

字体家族的名称。

2

-size number

无涯教程网

链接:https://www.learnfk.comhttps://www.learnfk.com/tcl-tk/tk-fonts.html

来源:LearnFk无涯教程网

字体大小。

3

-weight level

字体的粗细。

一个简单的字体创建示例如下所示-

#!/usr/bin/wish

font create myFont -family Helvetica -size 18 -weight bold 
pack [label .myLabel -font myFont -text "Hello World"]

当无涯教程运行上面的程序时,将获得以下输出-

Fonts Example

要获得所有可用的字体,可以使用以下命令-

#!/usr/bin/wish

puts [font families]

当运行上面的命令时,将获得以下输出-

{Abadi MT Condensed Extra Bold} {Abadi MT Condensed Light} {Al Bayan} {Al Nile}
{Al Tarikh} {American Typewriter} {Andale Mono} Arial {Arial Black}
{Arial Hebrew} {Arial Narrow} {Arial Rounded MT Bold} {Arial Unicode MS}
Athelas Avenir {Avenir Next} {Avenir Next Condensed} Ayuthaya Baghdad {Bangla MN}
{Bangla Sangam MN} {Baoli SC} Baskerville {Baskerville Old Face} Batang {Bauhaus 93}
Beirut {Bell MT} {Bernard MT Condensed} BiauKai {Big Caslon} {Book Antiqua}
{Bookman Old Style} {Bookshelf Symbol 7} Braggadocio {Britannic Bold} {Brush Script MT}
Calibri {Calisto MT} Cambria {Cambria Math} Candara Century {Century Gothic}
{Century Schoolbook} Chalkboard {Chalkboard SE} Chalkduster {Charcoal CY} Charter
Cochin {Colonna MT} {Comic Sans MS} Consolas Constantia {Cooper Black} Copperplate
{Copperplate Gothic Bold} {Copperplate Gothic Light} Corbel {Corsiva Hebrew} Courier
{Courier New} {Curlz MT} Damascus {DecoType Naskh} Desdemona {Devanagari MT}
{Devanagari Sangam MN} Didot {DIN Alternate} {DIN Condensed} {Diwan Kufi} {Diwan Thuluth}
{Edwardian Script ITC} {Engravers MT} {Euphemia UCAS} Eurostile Farah Farisi
{Footlight MT Light} {Franklin Gothic Book} {Franklin Gothic Medium}
Futura Gabriola Garamond {GB18030 Bitmap} {Geeza Pro} Geneva {Geneva CY}
Georgia {Gill Sans} {Gill Sans MT} {Gloucester MT Extra Condensed}
{Goudy Old Style} {Gujarati MT} {Gujarati Sangam MN} Gulim GungSeo {Gurmukhi MN}
{Gurmukhi MT} {Gurmukhi Sangam MN} Haettenschweiler {Hannotate SC} {Hannotate TC}
{HanziPen SC} {HanziPen TC} Harrington HeadLineA Hei {Heiti SC} {Heiti TC}
Helvetica {Helvetica CY} {Helvetica Neue} Herculanum {Hiragino Kaku Gothic Pro}
{Hiragino Kaku Gothic ProN} {Hiragino Kaku Gothic Std} {Hiragino Kaku Gothic StdN}
{Hiragino Maru Gothic Pro} {Hiragino Maru Gothic ProN}
{Hiragino Mincho Pro} {Hiragino Mincho ProN} {Hiragino Sans GB}
{Hoefler Text} Impact {Imprint MT Shadow} InaiMathi {Iowan Old Style} Kai Kailasa
{Kaiti SC} {Kaiti TC} {Kannada MN} {Kannada Sangam MN} Kefa {Khmer MN} {Khmer Sangam MN}
{Kino MT} Kokonor Krungthep KufiStandardGK {Lantinghei SC} {Lantinghei TC} {Lao MN}
{Lao Sangam MN} {Libian SC} {LiHei Pro} {LiSong Pro} {Lucida Blackletter} {Lucida Bright}
{Lucida Calligraphy} {Lucida Console} {Lucida Fax} {Lucida Grande} {Lucida Handwriting}
{Lucida Sans} {Lucida Sans Typewriter} {Lucida Sans Unicode} {Malayalam MN}
{Malayalam Sangam MN} Marion {Marker Felt} Marlett {Matura MT Script Capitals}
Meiryo Menlo {Microsoft Sans Serif} Mishafi Mistral {Modern No. 20} Monaco {MS Gothic}
{MS Mincho} {MS PGothic} {MS PMincho} {MS Reference Sans Serif} {MS Reference Specialty}
Mshtakan {MT Extra} Muna {Myanmar MN} {Myanmar Sangam MN} Nadeem {Nanum Brush Script}
{Nanum Gothic} {Nanum Myeongjo} {Nanum Pen Script} {New Peninim MT} {News Gothic MT}
Noteworthy Onyx Optima {Oriya MN} {Oriya Sangam MN} Osaka Palatino {Palatino Linotype}
Papyrus PCMyungjo Perpetua {Perpetua Titling MT} PilGi {Plantagenet Cherokee}
Playbill PMingLiU {PT Mono} {PT Sans} {PT Sans Caption} {PT Sans Narrow} {PT Serif}
{PT Serif Caption} Raanana Rockwell {Rockwell Extra Bold} Sana Sathu {Savoye LET}
Seravek Silom SimSun {Sinhala MN} {Sinhala Sangam MN} Skia {Snell Roundhand} {Songti SC}
{Songti TC} Stencil STFangsong STHeiti STIXGeneral STIXIntegralsD STIXIntegralsSm
STIXIntegralsUp STIXIntegralsUpD STIXIntegralsUpSm STIXNonUnicode STIXSizeFiveSym
STIXSizeFourSym STIXSizeOneSym STIXSizeThreeSym STIXSizeTwoSym STIXVariants STKaiti
STSong Superclarendon Symbol Tahoma {Tamil MN} {Tamil Sangam MN} TeamViewer8 {Telugu MN}
{Telugu Sangam MN} Thonburi Times {Times New Roman} {Trebuchet MS} {Tw Cen MT} Verdana
Waseem {Wawati SC} {Wawati TC} Webdings {Weibei SC} {Weibei TC} {Wide Latin} Wingdings
{Wingdings 2} {Wingdings 3} {Xingkai SC} {Yuanti SC} YuGothic YuMincho {Yuppy SC}
{Yuppy TC} {Zapf Dingbats} Zapfino {Apple Braille} {Apple Chancery} {Apple Color Emoji}
{Apple LiGothic} {Apple LiSung} {Apple SD Gothic Neo} {Apple Symbols}
AppleGothic AppleMyungjo {Monotype Corsiva} {Monotype Sorts}

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

人工智能基础课 -〔王天一〕

白话法律42讲 -〔周甲徳〕

说透中台 -〔王健〕

NLP实战高手课 -〔王然〕

后端存储实战课 -〔李玥〕

系统性能调优必知必会 -〔陶辉〕

乔新亮的CTO成长复盘 -〔乔新亮〕

技术领导力实战笔记 2022 -〔TGO 鲲鹏会〕

超级访谈:对话道哥 -〔吴翰清(道哥)〕

好记忆不如烂笔头。留下您的足迹吧 :)