tkinter text font
时间: 2023-08-24 07:08:03 浏览: 147
Python-Tkinter Text输入内容在界面显示的实例
To set the font for a text widget in tkinter, you can use the `font` option. Here's an example:
```python
import tkinter as tk
root = tk.Tk()
text = tk.Text(root, font=("Helvetica", 12))
text.pack()
root.mainloop()
```
In this example, we create a `Text` widget and set its font to "Helvetica" with a size of 12. You can adjust the font family and size to your liking.
阅读全文