Python GUI編程(Tkinter)6、Text控件


import tkinter

#創建主窗口
win = tkinter.Tk()
#設置標題
win.title("sunck")
#設置大小和位置
win.geometry("400x400+200+20")

'''
文本控件,用於顯示多行文本
'''

#height顯示的行數
text = tkinter.Text(win, width=30, height=4)
text.pack()
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 answer'''
text.insert(tkinter.INSERT, str)

win.mainloop()


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM