0

so I'm new to Tkinter and I have no sample code for you to look at but I do have one question, which is how to make an entry widget have a limited amount of integers to choose from e.g:

when clicking on the input box, it gives options to choose certain integers like [1] [2] [3] and so on

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Coder Cody
  • 95
  • 1
  • 10
  • You wouldn't use an entry widget for this. Probably a drop down menu. If you are really stuck on using an entry widget you can use a validation method to restrict the numbers allowed to be used. – Mike - SMT Oct 17 '18 at 17:08
  • https://docs.python.org/3.1/library/tkinter.ttk.html#combobox – Bryan Oakley Oct 17 '18 at 17:36
  • Possible duplicate of [How can I create a dropdown menu from a List in Tkinter?](https://stackoverflow.com/questions/45441885/how-can-i-create-a-dropdown-menu-from-a-list-in-tkinter) – Brian Tompsett - 汤莱恩 Mar 13 '19 at 18:43

1 Answers1

0

Click here for more information

from tkinter import *

master = Tk()

variable = StringVar(master)
variable.set("one") # default value

w = OptionMenu(master, variable, "one", "two", "three")
w.pack()

mainloop()
TheLizzard
  • 7,248
  • 2
  • 11
  • 31