Python 3 中tkinter 里的滚动文本框(ScrolledText) |
您所在的位置:网站首页 › 滤波时间常数是什么 › Python 3 中tkinter 里的滚动文本框(ScrolledText) |
最近在写一个模拟做题系统,里面有一个输出错题的功能,设置的文本框只有输出一道错题的大小,但是不能就一道题吧,就想到了平时页面里的滚动文本框,上网搜了搜,查到了ScrolledText,但是没找到实现我所需要功能的具体方法,没办法,我就自己研究了研究,好在最后实现了,现在就附上我的实现代码: def cuotiwin(): global score #分数 global list2 #存放错题 var1=StringVar window = Tk() window.title("我的C语言做题系统") # title() 定义这个窗口的标题 window.geometry("1000x500") # geometry() 定义窗口的大小 scr = scrolledtext.ScrolledText(window, width=70, height=13,font=("隶书",18)) #滚动文本框(宽,高(这里的高应该是以行数为单位),字体样式) scr.place(x=50, y=50) #滚动文本框在页面的位置 i = "你太优秀了,没有错题!" def panduan(): i ="你太优秀了,没有错题!" if score == 100: scr.insert(END,i) else: for b in list2: #遍历错题列表 scr.insert(END,b) #将错题显示在动文本框中 panduan() def exit(): caidanwin() #跳转页面 window.destroy() #跳转后关闭当前窗口 button2 = Button(window, text="返 回", font=("隶书", 20), command=exit) button2.place(x=700, y=420, width=150, height=60) window.mainloop()
实现结果如下:
|
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |