Python TK input box Entry sets height
1. Operating environment
Operating system: Windows 10 Professional Edition, IDE: PyCharm 2020.2.3 (Community Edition), SDK: Python 3.7
2. Code and pictures
Baidu’s AI
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
entry_widget = ttk.Entry(root)
entry_widget['width'] = 30 # 设置输入框的宽度为30个字符单位
entry_widget['height'] = 5 # 设置输入框的行数为5行
entry_widget.pack()
root.mainloop()
running error
CharGPT
operation result
I guess iFlytek's is just like that.
actual code
Just set the entry font size. Actual code snippet
# 第2行
self.txt_spider_url = AdenEntry(self.root, font=('Arial 18 bold'), fg='red')
self.txt_spider_url.grid(row=1, column=0, sticky=TkPlugin.sticky_all(), padx="12", pady="10")
Just set font=('Arial 18 bold'). In addition, I encapsulated the control with AdenEntry. Rendering:
Okay, let’s end it here.