最简单的方法是使用高度为1行的禁用的文本小部件:
from Tkinter import *master = Tk()w = Text(master, height=1, borderwidth=0)w.insert(1.0, "Hello, world!")w.pack()w.configure(state="disabled")# if tkinter is 8.5 or above you'll want the selection background# to appear like it does when the widget is activated# comment this out for older versions of Tkinterw.configure(inactiveselectbackground=w.cget("selectbackground"))mainloop()
您可以以类似方式使用条目窗口小部件。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)