12

I noticed that the width argument for the Tkinter entry widget is in characters, not pixels.

Is it possible to adjust the width in pixels?

Cœur
  • 37,241
  • 25
  • 195
  • 267
rectangletangle
  • 50,393
  • 94
  • 205
  • 275

3 Answers3

22

You can also use the Place geometry manager:

entry.place(x=10, y=10, width=100) #width in pixels
noob oddy
  • 1,314
  • 8
  • 11
6

You cannot specify the width in pixels using the '-width' option, but there are ways to accomplish the same thing. For example, you could pack an entry in a frame that has no border, turn off geometry propagation on the frame, then set the width of the frame in pixels.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
2

You can use "ipadx" and "ipady" while packing the "Entry" widget.

You can also use it with "grid".

import tkinter as tk

root = tk.Tk

e = tk.Entry()
e.pack(ipadx=100, ipady=15)

tk.mainloop()

DaniyalAhmadSE
  • 807
  • 11
  • 20