Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tkinter Entry size limit
#1
I'm writing a program in Tkinter.

One page is a form, where the user inputs various values.
How do I limit an Entry field to a specific size?

For example, I use the following code, so that the user can put in their zip code:

    # Zip code
    label_for_zipc = Label(main_window, text='Zip code: (First 5 digits)', fg="blue")
    label_for_zipc.config(font=('helvetica', 16))
    canvas.create_window(0.7*hshift*fnl_x, fnl_y+vertShift, window=label_for_zipc)
    canvas.create_window(0.7*hshift*fnl_x, fnl_y+vertShift+30, window=entry_for_zipc)
The function that includes the above lines includes many other entry fields.
There is a "Proceed" Button, which will write all the input to a file, as well as bringing up another
Tkinter window for more input.

The problem I have is that, even though I limited the field size/length of "entry_for_zipc" to 5,
the user can type more than 5 characters in the entry field.
How do I program it so that the user cannot type more than 5 characters in the entry field?

Thanks.
Reply


Messages In This Thread
Tkinter Entry size limit - by vman44 - Dec-21-2022, 06:50 AM
RE: Tkinter Entry size limit - by menator01 - Dec-21-2022, 08:15 AM
RE: Tkinter Entry size limit - by deanhystad - Dec-22-2022, 12:08 AM
RE: Tkinter Entry size limit - by vman44 - Dec-22-2022, 06:58 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how to open a popup window in tkinter with entry,label and button lunacy90 1 946 Sep-01-2023, 12:07 AM
Last Post: lunacy90
  Auto increament in Entry field. in tkinter GUI cybertooth 7 4,229 Sep-17-2021, 07:56 AM
Last Post: cybertooth
  How to rotate log and limit the size maiya 0 1,776 Aug-29-2020, 12:41 AM
Last Post: maiya
  How to limit the fie size in logging. maiya 2 7,383 Jul-29-2020, 06:49 AM
Last Post: maiya
  size of set vs size of dict zweb 0 2,169 Oct-11-2019, 01:32 AM
Last Post: zweb
  Restrict / Limit variable size mln4python 4 7,237 Aug-13-2019, 07:17 AM
Last Post: mln4python
  CSV file created is huge in size. How to reduce the size? pramoddsrb 0 10,520 Apr-26-2018, 12:38 AM
Last Post: pramoddsrb
  Help pulling tkinter Entry string data Raudert 8 10,092 Jan-12-2017, 11:49 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020