Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an option to edit the padding inside of a Tkinter EntryBox?

Tags:

python

tkinter

Is there an option to edit the padding inside of a Tkinter EntryBox? So that the text that the user inputs starts e.g. 10px from the left border.

like image 972
Raven Avatar asked Oct 18 '22 02:10

Raven


1 Answers

Technically, yes if you are using .grid().

Using:

grid(ipadx=HORIZONTAL-PADDING, ipady=VERTICAL-PADDING)

Is what the documentation says, however it doesn't seem to dictate how the text bbehaves. I can only get it to work for ipady. ipadx seems to just add extra padding to extend the width of the Entry widget without the text moving right.

import tkinter as tk

root = tk.Tk()
entry = Entry(root)
entry.grid(row=0,column=0,ipadx=10)

root.mainloop()

Reference: http://effbot.org/tkinterbook/grid.htm

like image 123
D'Arcy Avatar answered Oct 21 '22 06:10

D'Arcy