강의

멘토링

커뮤니티

Inflearn Community Q&A

traceimp's profile image
traceimp

asked

[4-Week Course] <Web Browser from Scratch> Reading Challenge

[Fri] Understanding the Concept of Fonts and Text Styling (p.89-p.102)

91페이지 코드 질문

Written on

·

57

1

91페이지 첫번째 코드에
imprt tkinter.Font 해보면 찾질 못하더라고요.

완성본 보니 import tkinter.font라고 적혀있고 그 뒤의 코드들은 없던데... 테스트 해보려면 어떻게 써봐야 하나요?

javascriptpython네트워크frontendweb-browser

Answer 1

1

teeddub님의 프로필 이미지
teeddub
Instructor

안녕하세요 김구리님.

91 페이지 코드입니다.

import tkinter.font

window = tkinter.Tk()
bi_times = tkinter.font.Font(
    family="Times",
    size=16,
    weight="bold",
    slant="italic",
)

canvas = tkinter.Canvas(window, width=400, height=200)
canvas.pack()
canvas.create_text(200, 100, text="Hi!", font=bi_times)

window.mainloop()

 

아울러 본문의 tkinter.Fonttkinter.font로 수정해주세요.

traceimp님의 프로필 이미지
traceimp
Questioner

확인 감사합니다! 이후는 tkinter.font로 진행해보겠습니다.

traceimp's profile image
traceimp

asked

Ask a question