DayLy
DayLy

Reputation: 39

Tkinter - Entry widget text to go to next line instead of continuing to the side

so I made my entry widget for user input and made ipady larger. I thought this would make it so the text will automatically go to the next line but the text continues on. Is it possible to make the entry so that the text goes down instead and if it passes the length of ipady then create a scrollbar?

    def body(self, master):
#input fields for username and passwords
        Label(master, text="Name:").grid(row=1, column=1, sticky=W),
        Label(master, text="Date:").grid(row=2, column=1, sticky=W)
        Label(master, text=":").grid(row=4)
        Label(master, text=":").grid(row=3, column=3)
        Label(master, text=":").grid(row=5)
        Label(master, text=":").grid(row=7)
        Label(master, text="L").grid(row=6)

        self.text = tk.StringVar()
        self.text.set(':')

        self.text1 = tk.StringVar()
        self.text1.set(':')

#input fields for tags
#Entry fields
        self.e1 = Entry(master)
        self.e2 = Entry(master)
        self.e3 = Entry(master, textvariable = self.text)
        self.e4 = Entry(master)
        self.e5 = Entry(master, textvariable = self.text1)
        self.e6 = Entry(master)
        self.e7 = Entry(master)

#Entry field Placement
        self.e1.grid(row=1, column=1, columnspan=2, ipadx=50)
        self.e2.grid(row=2, column=1, columnspan=2, ipadx=50)
        self.e3.grid(row=4, column=1, ipadx=150)
        self.e4.grid(row=4, column=3, ipadx=150, ipady=75)
        self.e5.grid(row=5, column=1, ipadx=150, ipadx=75)
        self.e6.grid(row=5, column=3, ipadx=150)
        self.e7.grid(row=6, column=1, ipadx=10, sticky=W)

Upvotes: 0

Views: 806

Answers (2)

Dulnath Vanderbona
Dulnath Vanderbona

Reputation: 7

Entry widgents have only a single line. You'll have to use a 'Text' widget and print ('\n') for every entery letter.

Upvotes: 1

Bryan Oakley
Bryan Oakley

Reputation: 385900

Is it possible to make the entry so that the text goes down instead ...?

No, it is not. The Entry widget is specifically designed for single-line input. If you need multiple lines you need to use the Text widget.

Upvotes: 4

Related Questions