Re: [問題] 怎麼用*排出數字

看板Python作者 (艾爾文)時間6年前 (2019/07/07 14:58), 編輯推噓3(300)
留言3則, 3人參與, 6年前最新討論串3/3 (看更多)
※ 引述《ben1357956 (QQ雞腿)》之銘言: : 如題 : 我想要輸入一串數字 : 自動輸出成米字號的樣子 : 像是輸入1 : 跑出下列這樣 : * : * : * : * : * : * : * : 新手上路,多多指教 其實我回了關鍵字 "Monochrome font rendering with FreeType and Python", 可能沒有人看. 如果你 google 一下, 很容易找到相關的 topic. 這裡有完整的說明: https://tinyurl.com/nqpsyv3 範例原始碼在: https://tinyurl.com/y5b7e3op 使用前先安裝模組: pip install freetype-py 範例程式上用的是 Helvetica.ttf. 可以去網路上下載. 但你可以使用自己電腦上的任何一個字形. 以我常用的 Times New Roman 為例, 找到 Windows\Fonts 目錄下的 Times New Roman, 複製出來, 會至少有一個檔案叫 times.ttf. 更改 Helvetica.ttf 為 times.ttf. 然後, 將你的範程式和你的字形檔放在同一個目錄下. 然後,內容改一下, 看要顯示什麼, 例如 print(repr(fnt.render_text('Hello, ben1357956!'))) 然後 Wala~ 就出現美美的字形了. https://imgur.com/a/lbK0ChC -- Sent from my Windows -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.192.186.172 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1562482709.A.F02.html

07/07 17:01, 6年前 , 1F
讚喔(Y)
07/07 17:01, 1F

07/07 19:09, 6年前 , 2F
07/07 19:09, 2F

07/08 20:59, 6年前 , 3F
07/08 20:59, 3F
文章代碼(AID): #1T8PWLy2 (Python)
討論串 (同標題文章)
文章代碼(AID): #1T8PWLy2 (Python)