1、添加一个输入框
代码:
# coding:utf-8
from tkinter import *
root = Tk()
root.title("test")
root.geometry("200x100")
root.resizable(width=False, height=False)
l = Entry(root) # 添加输入框
l.pack()
root.mainloop()
显示:
2、修改输入框高度
代码:
# coding:utf-8
from tkinter import *
root = Tk()
root.title("test")
root.geometry("200x100")
root.resizable(width=False, height=False)
l = Entry(root)
l.place(width=150, height=50) # width:长度;height:高度
root.mainloop()
显示:
3、输入框点击后,高亮加颜色
代码:
# coding:utf-8
from tkinter import *
root = Tk()
root.title("test")
root.geometry("200x100")
root.resizable(width=False, height=False)
l = Entry(root, highlightcolor='red', highlightthickness=1) # highlightcolor:颜色
l.place(width=150, height=50) # width:长度;height:高度
root.mainloop()
显示: