0

Здраствуйте, хотел бы узнать у меня имеется шрифт Open Sans я бы хотел узнать как его можно было бы использовать в Custom Tkinter.

2 ответа 2

0

Модуль tkinter.font предоставляет класс Font для создания и использования именованных шрифтов.

import tkinter as tk
from tkinter import font

root = tk.Tk()
root.title("My Font")

font = font.Font(family="Open San", size=14, weight="normal")

label = tk.Label(text="Hello World", font=font)
label.pack()

root.mainloop()
0

Вот пример:

import tkinter as tk

root = tk.Tk()
root.title("Tkinter")

font = ("Open Sans", 14)

label = tk.Label(root, text="This id 'Open Sans' Font", font=font)
label.pack()

root.mainloop()

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.