So I have a make story button, but I want it to be so if the entry boxes are empty or an adjective is not selected, it refreshes the window and does not make the story(continue on with code). I have tried using self.destory() and self.update(), but each time it says it is missing a positional argument 'self'. ANd then once I change it to self.destroy.(self), it says GUI has no attribute 'children"(like what lol)
Here is my code for the make story and refresh method (all of this is in a GUI class which I did not include here since it would take too much space)(my main window tho is called self.main_window)
def refresh(self):
self.main_window.destroy(self)
self.__init__()
def make_story(self):
'''makes the story'''
#gets the entrys
person = self.person_entry.get()
# selctets body part based on raido button selected
bodypart = ""
if self.radio_var.get() == 1:
bodypart = 'forehead'
if self.cb_var1.get() == 1:
adjective1 = "silly"
if person.strip() =="" or self.cb_var1.get() == 0:
tkinter.messagebox.showinfo('Error', "Please make sure all entry boxes are filled and at least one adjective is selected")
self.refresh()
else:
pass
text_box = Text(self.eight_frame, height = 10, width = 52, bg = "pink")
story = "The famous singer " + person
text_box.insert(INSERT,story)
text_box.pack()