You can use the tkMessageBox
module to show error boxes.
from Tkinter import *
import tkMessageBox
def clicked():
tkMessageBox.showerror("Error", "Please only input whole numbers")
root = Tk()
button = Button(root, text = "show message box", command = clicked)
button.pack()
root.mainloop()
Also any idea how i can limit the input to just Integers?
You can use validatecommand
to reject input that doesn't fit your specifications.
from Tkinter import *
def validate_entry(text):
if text == "": return True
try:
value = int(text)
except ValueError: #oops, couldn't convert to int
return False
return 0 <= value <= 100
root = Tk()
vcmd = (root.register(validate_entry), "%P")
entry = Entry(root, validate = "key", validatecommand=vcmd)
entry.pack()
root.mainloop()