I'm new to python and I'm trying to make a GUI window with Tkinter that executes a command. I wrote the code underneath but it wont work. What is wrong with it? The required imports are imported like tk and ttk.
This is the tkinter window code:
root = Tk()
root.geometry("600x450")
root.title("Points")
Label(root, text=PlayerPoints,font=('Ubuntu')).pack(pady=30)
btn= ttk.Button(root, text="Add more points",command=AddPoints)
btn.pack()
Here is the AddPoints commands code (not the full thing but enough to make the error show up):
PointsToAdd = int(input("How many points do you want to add?"))
print(PointsToAdd, "points will be added.")
And here is the error i get:
Exception has occurred: RuntimeError (note: full exception trace is shown but execution is paused at: AddPoints)
can't re-enter readline
An example code to paste in a code editor to see the error yourself:
from tkinter import *
from tkinter import ttk
PlayerPoints = 100
def AddPoints():
PointsToAdd = int(input("How many points do you want to add?"))
print(PointsToAdd, "points will be added.")
root = Tk()
root.geometry("600x450")
root.title("Points")
Label(root, text=PlayerPoints,font=('Ubuntu')).pack(pady=30)
btn= ttk.Button(root, text="Add more points",command=AddPoints)
btn.pack()
n = input("this is just to make Python wait for an input instead of killing the program")