Python‎ > ‎tkinter‎ > ‎

tkinter.Text


Definition
The syntax returns the text widget in parent widget.

Syntax
tkinter.Text()
Text()

Options
Text(background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, padx, pady, relief, selectbackground, selectborderwidth, selectforeground, setgrid, takefocus, xscrollcommand, yscrollcommand)

Widget specific options
Text(autoseparators, height, maxundo, spacing1, spacing2, spacing3, state, tabs, undo, width, wrap)

Examples
The text returns with the text.
from tkinter import*
import tkinter
    
master=tkinter.Tk()

text=tkinter.Text(master)
text.pack()

master.mainloop()





tkinter.Text().pack()
The code create the text() through button and then destroy and created new buttom compose.
from tkinter import*
from tkinter import Text
import tkinter
    
master=tkinter.Tk()

def message():
    compose_button.destroy()

    send_message_button=tkinter.Button(master, text="Submit Message")
    send_message_button.pack()
      
    compose_text=tkinter.Text(master)
    compose_text.pack()
    


compose_button=tkinter.Button(master, text="Compose Message",command=message)
compose_button.pack()


master.mainloop()










tkinter


Comments