Jun-17-2019, 12:51 AM
i have a tkinter gui wiht buttons. i have a button that enters random values inside a certain entry. i have a randint that a assigns that random value. however once assigend the button press will only use that same value. i want each time to use a differnt value. how to i accomplish this?
code i have:
code i have:
root = Tk( )
entry = Entry(root, textvariable = number)
entry_random = str(randint(2, 10))
def entryrandom():
entry.insert(END, entry_random)
Button(root, text = "random", width = 10, height = 1, command = entryrandom).grid(row=5, column=2)
