Python tkinter.messagebox.askyesnocancel() Examples

The following are 11 code examples of tkinter.messagebox.askyesnocancel(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkinter.messagebox , or try the search function .
Example #1
Source File: IOBinding.py    From Fluid-Designer with GNU General Public License v3.0 7 votes vote down vote up
def maybesave(self):
        if self.get_saved():
            return "yes"
        message = "Do you want to save %s before closing?" % (
            self.filename or "this untitled document")
        confirm = tkMessageBox.askyesnocancel(
                  title="Save On Close",
                  message=message,
                  default=tkMessageBox.YES,
                  parent=self.text)
        if confirm:
            reply = "yes"
            self.save(None)
            if not self.get_saved():
                reply = "cancel"
        elif confirm is None:
            reply = "cancel"
        else:
            reply = "no"
        self.text.focus_set()
        return reply 
Example #2
Source File: gb_ide.py    From greenBerry with Apache License 2.0 7 votes vote down vote up
def wclose(self, event=0):
        if self.parent.title()[0] == "*":
            save = messagebox.askyesnocancel(
                "Save file",
                "You have unsaved changes.\nDo you want to save before closing?",
            )

            if save:
                self.save_file()
                if self.parent.title()[0] == "*":
                    self.wclose()
                else:
                    root.destroy()

            elif not save:
                root.destroy()
        else:
            root.destroy() 
Example #3
Source File: IOBinding.py    From ironpython3 with Apache License 2.0 6 votes vote down vote up
def maybesave(self):
        if self.get_saved():
            return "yes"
        message = "Do you want to save %s before closing?" % (
            self.filename or "this untitled document")
        confirm = tkMessageBox.askyesnocancel(
                  title="Save On Close",
                  message=message,
                  default=tkMessageBox.YES,
                  parent=self.text)
        if confirm:
            reply = "yes"
            self.save(None)
            if not self.get_saved():
                reply = "cancel"
        elif confirm is None:
            reply = "cancel"
        else:
            reply = "no"
        self.text.focus_set()
        return reply 
Example #4
Source File: IOBinding.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 6 votes vote down vote up
def maybesave(self):
        if self.get_saved():
            return "yes"
        message = "Do you want to save %s before closing?" % (
            self.filename or "this untitled document")
        confirm = tkMessageBox.askyesnocancel(
                  title="Save On Close",
                  message=message,
                  default=tkMessageBox.YES,
                  parent=self.text)
        if confirm:
            reply = "yes"
            self.save(None)
            if not self.get_saved():
                reply = "cancel"
        elif confirm is None:
            reply = "cancel"
        else:
            reply = "no"
        self.text.focus_set()
        return reply 
Example #5
Source File: GUI_message_box_yes_no_cancel.py    From Python-GUI-Programming-Cookbook-Second-Edition with MIT License 5 votes vote down vote up
def _msgBox():
#     msg.showinfo('Python Message Info Box', 'A Python GUI created using tkinter:\nThe year is 2017.')  
#     msg.showwarning('Python Message Warning Box', 'A Python GUI created using tkinter:\nWarning: There might be a bug in this code.')
#     msg.showerror('Python Message Error Box', 'A Python GUI created using tkinter:\nError: Houston ~ we DO have a serious PROBLEM!')
    answer = msg.askyesnocancel("Python Message Multi Choice Box", "Are you sure you really wish to do this?")
    print(answer)
            
# Add another Menu to the Menu Bar and an item 
Example #6
Source File: db_update.py    From nekros with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def action(self):
        # 1 = True    &   2 = False
        if self.cb1.get() == 1:
            self.payment_success()
        elif self.cb2.get() == 1:
            self.delete_1_record()
        elif self.cb3.get() ==1:
            self.retrive_decryption_key()
        elif self.cb4.get() == 1:
            ans = tmsg.askyesnocancel("Questions", "You are Going to Delete All Records, Are U Sure & Want to do this?")
            if ans == True:            
                self.delete_all_record() 
            elif ans == False:
                tmsg.showwarning("Warning", "Don't Tick this option, If you don't want to erase all DB_Records!") 
Example #7
Source File: GUI_message_box_yes_no_cancel.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def _msgBox():
#     msg.showinfo('Python Message Info Box', 'A Python GUI created using tkinter:\nThe year is 2019.')  
#     msg.showwarning('Python Message Warning Box', 'A Python GUI created using tkinter:\nWarning: There might be a bug in this code.')
#     msg.showerror('Python Message Error Box', 'A Python GUI created using tkinter:\nError: Houston ~ we DO have a serious PROBLEM!')
    answer = msg.askyesnocancel("Python Message Multi Choice Box", "Are you sure you really wish to do this?")
    print(answer)
            
# Add another Menu to the Menu Bar and an item 
Example #8
Source File: plistwindow.py    From ProperTree with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def check_save(self):
        if not self.edited:
            return True # No changes, all good
        # Post a dialog asking if we want to save the current plist
        answer = mb.askyesnocancel("Unsaved Changes", "Save changes to {}?".format(self.get_title()))
        if answer == True:
            return self.save_plist()
        return answer 
Example #9
Source File: code.py    From thonny with MIT License 5 votes vote down vote up
def check_allow_closing(self, editor=None):
        if not editor:
            modified_editors = [e for e in self.winfo_children() if e.is_modified()]
        else:
            if not editor.is_modified():
                return True
            else:
                modified_editors = [editor]
        if len(modified_editors) == 0:
            return True

        message = "Do you want to save files before closing?"
        if editor:
            message = "Do you want to save file before closing?"

        confirm = messagebox.askyesnocancel(
            title="Save On Close", message=message, default=messagebox.YES
        )

        if confirm:
            for editor_ in modified_editors:
                if editor_.get_filename(True):
                    editor_.save_file()
                else:
                    return False
            return True

        elif confirm is None:
            return False
        else:
            return True 
Example #10
Source File: main_file.py    From Attendance-Management-using-Face-Recognition with GNU General Public License v3.0 4 votes vote down vote up
def capture_and_mark(self):
		sl = StudentsList(self.class_name)
		students, roll_numbers = sl.load_pkl_file()

		FaceDetectObj = FaceDetect(self.class_name)

		Yes = True
		No = False
		Cancel = None

		i = 0
		while i <= 2:
			captured_image=None
			frame=None
			
			students_present = []
			while len(students_present) == 0:
				captured_image, frame = capture()
				students_present = FaceDetectObj.recognize(captured_image, roll_numbers)
				if students_present == "No Training Data":
					return

			try:
				name_student_present = students[roll_numbers.index(students_present[0])]
			except:
				messagebox.showerror("Error", "Recognized student not in database\nUnable to mark attendance")
				return

			response = messagebox.askyesnocancel("Confirm your identity", students_present[0]+'\n'+name_student_present)
			
			if response is Yes:
				wb = excel.attendance_workbook(self.class_name)
				excel.mark_present(wb, students_present, self.class_name)
				img_path=os.path.join(os.getcwd(), 'images', self.class_name, "s"+students_present[0][-2:],os.path.basename(captured_image))
				cv2.imwrite(img_path,frame)
				os.remove(captured_image)
				messagebox.showinfo("Attendance Confirmation", "Your attendance is marked!")
				break
			elif response is Cancel:
				break
			elif response is No:
				if i == 2:
					img_path=os.path.join(os.getcwd(), 'images',self.class_name,"unrecognized students", os.path.basename(captured_image))
					cv2.imwrite(img_path,frame)
					messagebox.showinfo("Unrecognized Student", "You were not recognized as any student of this class.\nYour attendance will be marked later if you really are")
					cv2.imwrite(img_path,frame)
				os.remove(captured_image)

			i += 1 
Example #11
Source File: chapter4_02.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 4 votes vote down vote up
def __init__(self):
        super().__init__()
        self.create_button(mb.askyesno, "Ask Yes/No",
                           "Returns True or False")
        self.create_button(mb.askquestion, "Ask a question",
                           "Returns 'yes' or 'no'")
        self.create_button(mb.askokcancel, "Ask Ok/Cancel",
                           "Returns True or False")
        self.create_button(mb.askretrycancel, "Ask Retry/Cancel",
                           "Returns True or False")
        self.create_button(mb.askyesnocancel, "Ask Yes/No/Cancel",
                           "Returns True, False or None")