tkinter.Text.pack


Definition
Configure the resources of the widget.

Syntax
tkinter().Text().pack()
Text().pack()

Options
  • Text.pack(
  • after=widget - pack it after you have packed widget
  • anchor=NSEW (or subset) - position widget according to given direction
  • before=widget - pack it before you will pack widget
  • expand=bool - expand widget if parent size grows
  • fill=NONE or X or Y or BOTH - fill widget if widget grows
  • in=master - use master to contain this widget
  • in_=master - see 'in' option description
  • ipadx=amount - add internal padding in x direction
  • ipady=amount - add internal padding in y direction
  • padx=amount - add padding in x direction
  • pady=amount - add padding in y direction
  • side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget.
  • )
Examples
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()









Comments