import tkinter

#创建主窗口

win = tkinter.Tk()

#设置标题

win.title("sunck")

#设置大小和位置

#win.geometry("400x400+200+20")

'''

文本控件,用于显示多行文本

'''

#创建滚动条

scroll = tkinter.Scrollbar()

text = tkinter.Text(win, width=50, height=8)

#side放到窗体的那一侧 fill填充

scroll.pack(side=tkinter.RIGHT, fill=tkinter.Y)

text.pack(side=tkinter.LEFT, fill=tkinter.Y)

#关联

scroll.config(command=text.yview)

text.config(yscrollcommand=scroll.set)

str = '''If there is anyone out there who still doubts that America is a place where all things are possible, who still wonders if the dream of our founders is alive in our time, who still questions the power of our democracy, tonight is your answerIt’s the answer told by lines that stretched around schools and churches in numbers this nation has never seen, by people who waited three hours and four hours, many for the first time in their lives, because they believed that this time must be different, that their voices could be that difference.'''

text.insert(tkinter.INSERT, str)

win.mainloop()

python为text添加滚动条_Python GUI编程(Tkinter)7、带滚动条的Text相关推荐

  1. python gui模板_Python GUI 编程(Tkinter) | 菜鸟教程

    Python GUI编程(Tkinter) Python 提供了多个图形开发界面的库,几个常用 Python GUI 库如下: Tkinter: Tkinter 模块(Tk 接口)是 Python 的 ...

  2. python窗口图形界面编程上传图片_python GUI编程(Tkinter) 创建子窗口及在窗口上用图片绘图实例...

    注意主窗口一定要为tk.Tk(),在主窗口上通过button的点击相应子函数创建子窗口,注意此时创建出来的窗口必须是Toplevel,否则出错. 至于用图片在窗口上绘图,则按代码所示即可. # -*- ...

  3. python的messagebox的用法_Python GUI编程学习笔记之tkinter中messagebox、filedialog控件用法详解...

    本文实例讲述了Python GUI编程学习笔记之tkinter中messagebox.filedialog控件用法.分享给大家供大家参考,具体如下: 相关内容: messagebox 介绍 使用 fi ...

  4. python listbox控件_Python GUI编程(Tkinter)10、Listbox控件

    import tkinter win = tkinter.Tk() win.title("sunck") win.geometry("400x400+200+0" ...

  5. python中mainloop添加背景_Python实例讲解 tkinter canvas (设置背景图片及文字)

    Python实例讲解 tkinter canvas (设置背景图片及文字) 2018-09-14 Python实例讲解 -- tkinter canvas (设置背景图片及文字) 博客分类:Pytho ...

  6. python gui编程框架添加工具栏_python gui编程,我是初学者。用tk,制作下拉菜单的command不分我想打开另一个界面。如和解决,求解!!...

    展开全部 from tkinter import * def new_file(): print("Open new file") def open_file(): print(& ...

  7. python canvas画移动物体_Python GUI编程入门(25)-移动Canvas对象

    Canvas对象生成之后,有时会希望调整对象的位置.例如前面文章中提到的时钟小程序,我们稍加改造可以另外实现一个指针式时钟: 在这个小程序中增加的功能就是根据具体时间计算每个指针的坐标信息,这部分功能 ...

  8. python中mainloop添加背景_Python实例讲解 - tkinter canvas (设置背景图片及文字)

    Python实例讲解 -- tkinter canvas (设置背景图片及文字) 先来一个绘图: from Tkinter import * master = Tk() w = Canvas(mast ...

  9. pythontkinter控件单选框怎么判断是否被选中_Python GUI编程(Tkinter)Radiobutton单选框控件...

    import tkinter win = tkinter.Tk() win.title("sunck") win.geometry("400x400+200+20&quo ...

最新文章

  1. 注册界面翻译_B站UP主自制的开源OCR翻译器走红Github,用一次就粉了
  2. 使用freemarker插入多行数据到word中
  3. 二分查找 寻找指定数 python 实现
  4. wxWidgets:wxArray<T>类用法
  5. php mysql查询结果_php对mysql查询结果进行分页 - ceil
  6. LeetCode 2075. 解码斜向换位密码(模拟)
  7. php数组删除key和值,php删除数组指定key的元素
  8. 蔚来:ET7首批预生产车正式下线
  9. Xamarin和Java开发安卓_将原生移动开发与Xamarin相结合
  10. vim YouCompleteMe
  11. oracle数据库tx锁,oracle数据库有把TX锁,如何定位锁在哪?
  12. 主流区块链底链技术横评 hyperledger fabric、fisco bcos、chainmaker
  13. 关于semantic-ui的cdn失效问题(怎样通过本地引用semantic-ui)
  14. Nvidia控制面板选择默认独显后黑屏的解决方法
  15. 阿里云 vps云监控插件已停止状态解决方法
  16. 信号与槽是如何实现的_Nature | 破解Wnt信号高效远距离传递之谜
  17. JLINK在线调试——软件调试方法与技巧
  18. MySQL数据库之GROUP BY用法
  19. 线性代数代码实现(二)上三角矩阵(C++)
  20. python requests+unittest+beautifulreport+jenkins实现接口自动化(上)

热门文章

  1. 方位话机同一号码双链路注册实现冗余
  2. SQL Server扩展事件(Extended Events)-- 将现有 SQL 跟踪脚本转换为扩展事件会话
  3. 业务安全通用解决方案——WAF数据风控
  4. J-LINK序列号修改
  5. crudandroidandroid——CRUD(在上一篇博客的基础上)
  6. 网络分层协议图以及各层的简介
  7. Struts国际化步骤
  8. sql 函数 汉字转拼音
  9. 想读读PyTorch底层代码?这份内核机制简介送给你
  10. Centos7 安装 Elasticsearch7.10(不错可以试试)