[英]How to add a text box with a vertical scroll bar and to a tkinter frame containing an accept and a decline button
我正在使用 Tkinter 并且我想创建一个被接受或拒绝的许可证表格。 这样做的最正确方法是什么?...创建一个框架,并添加一个 Tk() 根,其中一个 Text(root) 包含里面的所有文本,另一个 Tk() 在根下作为 root2,两个按钮一个标记为接受和拒绝? 还是我错过了另一种方式? 谢谢。
from tkinter import *
texteula= '''END USER LICENSE AGREEMENT...etc etc'''
# define master
Eula = Tk()
Eula.title('Licence Agreement')
# Vertical (y) Scroll Bar
scroll = Scrollbar(Eula)
scroll.pack(side=RIGHT, fill=Y)
# Text Widget
eula = Text(Eula, wrap=NONE, yscrollcommand=scroll.set)
eula.insert("1.0", texteula)
eula.pack()
button= Button(Eula,text='Accept',command=Eula.destroy)
button.pack(side=LEFT)
button2= Button(Eula,text='Decline')
button2.pack(side=RIGHT)
# Configure the scrollbars
scroll.config(command=eula.yview)
mainloop()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.