37,701
社区成员




tkinter Text.yview_scroll(number,what)怎么用呀
?????????????
我不想另外去初始化并设置一个Scrollbar控件
class TextCopyer():
def __init__(self):
import tkinter
#配置窗口top
top=tkinter.Tk()
top.title('抄写窗口')
top.geometry('800x200+270+500')
top.wm_attributes('-topmost',True)
#配置文本框控件txt
self.txt=tkinter.Text(top,
width=114,
height=12,
borderwidth=2,
bg='black',
fg='green'
)
self.txt.yview_scroll(-10,'units')
self.txt.yview()
self.txt.place(x=0,y=0)
top.mainloop()
if __name__ == '__main__':
TextCopyer()
from Tkinter import *
def Up10():
txt.yview_scroll(-10, 'units')
def Dn10():
txt.yview_scroll(10, 'units')
root=Tk()
Button(root, text="^^^", command=Up10).pack()
txt = Text(root, width=80, height=12)
txt.pack()
Button(root, text="vvv", command=Dn10).pack()
root.mainloop()