Basically, here is the problem
All of the user interface is within a tkinter message box. I have a program which the user inputs a string into a variable. String is checked if it is an integer. If yes; print this is an int, if no, launch another message box with a warning message, and an 'ok' button will be displayed.
This is the problem
I have written the code for the whole thing so far, below is the code for the warning message box:
from Tkinter import *
__author__ = 'Super'
def close_program():
root.destroy()
def number_checker():
global vehicle_distance
global vehicle_time
try:
vehicle_distance = float(vehicle_distance)
correct_text_distance()
except ValueError:
failed_text_distance()
try:
vehicle_time = float(vehicle_time)
correct_text_time()
except ValueError:
failed_text_time()
def failed_text_time():
global root
root = Tk()
root.title("Fatal Error")
root.geometry("300x30")
error_label = Label(root, text="Please input an integer for the field 'time'")
error_label.pack()
ok_button = Button(root, text="Ok", command=close_program)
ok_button.pack()
root.mainloop()
When the 'ok' button is pressed, the warning window closes, but when I re enter the values, and press the enter button again, it runs through the integer checker, then goes to deploy the warning message, and fails......
File "C:\Python27\lib\lib-tk\Tkinter.py", line 2036, in __init__
(widgetName, self._w) + extra + self._options(cnf))
TclError: can't invoke "label" command: application has been destroyed
I don't know why it doesn't want to launch that same message box again... It might have something to do with the 'Application has been destroyed'....
If anyone could help, that would be very useful