日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

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

發布時間:2024/9/19 python 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python为text添加滚动条_Python GUI编程(Tkinter)7、带滚动条的Text 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。