Python tkMessageBox.askokcancel() Examples
The following are 23
code examples of tkMessageBox.askokcancel().
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
tkMessageBox
, or try the search function
.
Example #1
Source File: base_dialog.py From PCWG with MIT License | 6 votes |
def validate_file_path(self): if len(self.filePath.get()) < 1: path = tkFileDialog.asksaveasfilename(parent=self.master,defaultextension=".xml", initialfile="%s.xml" % self.getInitialFileName(), title="Save New Config", initialdir=self.getInitialFolder()) self.filePath.set(path) if len(self.filePath.get()) < 1: tkMessageBox.showwarning( "File path not specified", "A file save path has not been specified, please try again or hit cancel to exit without saving.") return 0 if self.originalPath != None and self.filePath.get() != self.originalPath and os.path.isfile(self.filePath.get()): result = tkMessageBox.askokcancel( "File Overwrite Confirmation", "Specified file path already exists, do you wish to overwrite?") if not result: return 0 return 1
Example #2
Source File: PyShell.py From oss-ftp with MIT License | 6 votes |
def close(self): "Extend EditorWindow.close()" if self.executing: response = tkMessageBox.askokcancel( "Kill?", "The program is still running!\n Do you want to kill it?", default="ok", parent=self.text) if response is False: return "cancel" self.stop_readline() self.canceled = True self.closing = True return EditorWindow.close(self)
Example #3
Source File: gui.py From sky3ds.py with MIT License | 6 votes |
def format_confirm(self): sd = self.disk_choice.get() sd = tuple([x for x in sd[1:-1].split("'")]) #super ugly way to make string into tuple sd = sd[1] message = "Formatting %s will permanently erase all data and partitions on %s. \nPlease confirm that you have chosen the correct disk to format. \n \nFormatting can take several minutes to complete, please be patient." % (sd, sd) self.window.grab_release() self.window.wm_attributes("-topmost", 0) confirm = tkMessageBox.askokcancel("Confirm Format", message) self.window.wm_attributes("-topmost", 1) self.window.grab_set() if confirm == True: self.format_disk(sd) else: return
Example #4
Source File: ScriptBinding.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def ask_save_dialog(self): msg = "Source Must Be Saved\n" + 5*' ' + "OK to Save?" confirm = tkMessageBox.askokcancel(title="Save Before Run or Check", message=msg, default=tkMessageBox.OK, parent=self.editwin.text) return confirm
Example #5
Source File: main-gui.py From Tkinter-Projects with MIT License | 5 votes |
def close_player(self): if tkMessageBox.askokcancel("Quit", "Do you really want to close quit?"): try: self.player.pause() except: pass self.root.destroy()
Example #6
Source File: Tkeditor.py From Tkinter-Projects with MIT License | 5 votes |
def exit_editor(): if tkMessageBox.askokcancel("Quti", "Do you really want to quit?"): root.destroy()
Example #7
Source File: TkDrumMachine.py From Tkinter-Projects with MIT License | 5 votes |
def exit_app(self): if tkMessageBox.askokcancel("Quit", "Do you really want to quit?"): self.root.destroy() #basic UI
Example #8
Source File: spgl.py From Projects with GNU General Public License v3.0 | 5 votes |
def ask_ok_cancel(self, title, message): return messagebox.askokcancel(title, message)
Example #9
Source File: rts2.bak.py From rtsp with MIT License | 5 votes |
def handler(self): """Handler on explicitly closing the GUI window.""" self.pauseMovie() if tkMessageBox.askokcancel("Quit?", "Are you sure you want to quit?"): self.exitClient() else: # When the user presses cancel, resume playing. #self.playMovie() print "Playing Movie" threading.Thread(target=self.listenRtp).start() #self.playEvent = threading.Event() #self.playEvent.clear() self.sendRtspRequest(self.PLAY)
Example #10
Source File: TemplateEdit.py From SimplyTemplate with GNU General Public License v2.0 | 5 votes |
def exit_command(root): if tkMessageBox.askokcancel("Quit", "Do you really want to quit?"): root.destroy()
Example #11
Source File: spgl.py From SPGL with GNU General Public License v3.0 | 5 votes |
def ask_ok_cancel(self, title, message): return messagebox.askokcancel(title, message)
Example #12
Source File: spgl.py From SPGL with GNU General Public License v3.0 | 5 votes |
def ask_ok_cancel(self, title, message): return messagebox.askokcancel(title, message)
Example #13
Source File: PyShell.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def close(self): "Extend EditorWindow.close()" if self.executing: response = tkMessageBox.askokcancel( "Kill?", "Your program is still running!\n Do you want to kill it?", default="ok", parent=self.text) if response is False: return "cancel" self.stop_readline() self.canceled = True self.closing = True return EditorWindow.close(self)
Example #14
Source File: ScriptBinding.py From BinderFilter with MIT License | 5 votes |
def ask_save_dialog(self): msg = "Source Must Be Saved\n" + 5*' ' + "OK to Save?" confirm = tkMessageBox.askokcancel(title="Save Before Run or Check", message=msg, default=tkMessageBox.OK, master=self.editwin.text) return confirm
Example #15
Source File: gui.py From wikiteam with GNU General Public License v3.0 | 5 votes |
def askclose(): if tkMessageBox.askokcancel("Quit", "Do you really wish to exit?"): root.destroy()
Example #16
Source File: ScriptBinding.py From oss-ftp with MIT License | 5 votes |
def ask_save_dialog(self): msg = "Source Must Be Saved\n" + 5*' ' + "OK to Save?" confirm = tkMessageBox.askokcancel(title="Save Before Run or Check", message=msg, default=tkMessageBox.OK, master=self.editwin.text) return confirm
Example #17
Source File: PyShell.py From BinderFilter with MIT License | 5 votes |
def close(self): "Extend EditorWindow.close()" if self.executing: response = tkMessageBox.askokcancel( "Kill?", "The program is still running!\n Do you want to kill it?", default="ok", parent=self.text) if response is False: return "cancel" self.stop_readline() self.canceled = True self.closing = True # Wait for poll_subprocess() rescheduling to stop self.text.after(2 * self.pollinterval, self.close2)
Example #18
Source File: IOBinding.py From Splunking-Crime with GNU Affero General Public License v3.0 | 4 votes |
def print_window(self, event): confirm = tkMessageBox.askokcancel( title="Print", message="Print to Default Printer", default=tkMessageBox.OK, parent=self.text) if not confirm: self.text.focus_set() return "break" tempfilename = None saved = self.get_saved() if saved: filename = self.filename # shell undo is reset after every prompt, looks saved, probably isn't if not saved or filename is None: (tfd, tempfilename) = tempfile.mkstemp(prefix='IDLE_tmp_') filename = tempfilename os.close(tfd) if not self.writefile(tempfilename): os.unlink(tempfilename) return "break" platform = os.name printPlatform = True if platform == 'posix': #posix platform command = idleConf.GetOption('main','General', 'print-command-posix') command = command + " 2>&1" elif platform == 'nt': #win32 platform command = idleConf.GetOption('main','General','print-command-win') else: #no printing for this platform printPlatform = False if printPlatform: #we can try to print for this platform command = command % pipes.quote(filename) pipe = os.popen(command, "r") # things can get ugly on NT if there is no printer available. output = pipe.read().strip() status = pipe.close() if status: output = "Printing failed (exit status 0x%x)\n" % \ status + output if output: output = "Printing command: %s\n" % repr(command) + output tkMessageBox.showerror("Print status", output, parent=self.text) else: #no printing for this platform message = "Printing is not enabled for this platform: %s" % platform tkMessageBox.showinfo("Print status", message, parent=self.text) if tempfilename: os.unlink(tempfilename) return "break"
Example #19
Source File: gui.py From sky3ds.py with MIT License | 4 votes |
def backup_save(self): try: rom_list = sd_card.rom_list except: raise Exception("Please open a disk before attempting to backup a save.") index = view.tree_rom_table.focus() if index: item = view.tree_rom_table.item(index) tree_slot = item['values'][0] delete_list = [] delete_list.append(rom_list[tree_slot]) rom_info = controller.get_rom_info(delete_list)[0] title = rom_info[5] rom_code = rom_info[4] index = rom_info[0] # Instead of relying on the treeview and sd_card to be identical I check the rom_list slot = rom_list[index][0] else: raise Exception("Please select a rom to backup a save") destination_folder = tkFileDialog.askdirectory( initialdir = os.path.expanduser('~/Desktop'), mustexist = True) message = "Backup save for rom %s, %s to %s?" % (slot, title, destination_folder) if destination_folder: confirm = tkMessageBox.askokcancel("Confirm Save Backup", message) else: return if confirm == True: destination_file = destination_folder + "/" + rom_code + ".sav" message = "Dumping save from %s to %s" % (rom_code, destination_folder) task_text = "%s save backup" % title progress_bar = progress_bar_window("Dumping Save", message, mode = "indeterminate", maximum = 100, task = task_text) root.wait_visibility(progress_bar.progress) progress_bar.start_indeterminate() sd_card.dump_savegame( slot, destination_file ) progress_bar.progress_complete() else: return
Example #20
Source File: gui.py From sky3ds.py with MIT License | 4 votes |
def backup_rom(self): try: rom_list = sd_card.rom_list except: raise Exception("Please open a disk before attempting to dump a rom.") index = view.tree_rom_table.focus() if index: item = view.tree_rom_table.item(index) tree_slot = item['values'][0] delete_list = [] delete_list.append(rom_list[tree_slot]) rom_info = controller.get_rom_info(delete_list)[0] title = rom_info[5] rom_code = rom_info[4] index = rom_info[0] # Instead of relying on the treeview and sd_card to be identical I just pull all of the info out of the sd_card slot = rom_list[index][0] rom_size = rom_list[index][2] else: raise Exception("Please select a rom to dump.") destination_folder = tkFileDialog.askdirectory( initialdir = os.path.expanduser('~/Desktop'), mustexist = True) message = "Dump rom %s, %s to %s?" % (slot, title, destination_folder) if destination_folder: confirm = tkMessageBox.askokcancel("Confirm Rom Dump", message) else: return if confirm == True: destination_file = destination_folder + "/" + rom_code + ".3ds" message = "Dumping %s to %s" % (rom_code, destination_folder) task_text = "%s backup" % title progress_bar = progress_bar_window("Dumping Rom", message, mode = "determinate", maximum = rom_size, task = task_text) root.wait_visibility(progress_bar.window) sd_card.dump_rom( slot, destination_file, progress=progress_bar) else: return
Example #21
Source File: gui.py From sky3ds.py with MIT License | 4 votes |
def delete_rom(self): try: rom_list = sd_card.rom_list except: raise Exception("Please open a disk before attempting to delete a rom.") index = view.tree_rom_table.focus() if index: item = view.tree_rom_table.item(index) slot = item['values'][0] delete_list = [] delete_list.append(rom_list[slot]) rom_info = controller.get_rom_info(delete_list)[0] title = rom_info[5] slot = rom_info[0] # Instead of relying on the treeview and sd_card to be identical I just pull all of the info out of the sd_card else: raise Exception("Please select a rom to delete") message = "Delete rom %s, %s?" % (slot, title) confirm = tkMessageBox.askokcancel("Confirm Delete", message) if confirm == True: message = "Deleting %s." % title task_text = "delete" progress_bar = progress_bar_window("Deleting Rom", message, mode = "indeterminate", maximum = 100, task = task_text) root.wait_visibility(progress_bar.progress) progress_bar.start_indeterminate() sd_card.delete_rom(slot) progress_bar.progress_complete() controller.fill_rom_table() else: return
Example #22
Source File: IOBinding.py From oss-ftp with MIT License | 4 votes |
def print_window(self, event): confirm = tkMessageBox.askokcancel( title="Print", message="Print to Default Printer", default=tkMessageBox.OK, master=self.text) if not confirm: self.text.focus_set() return "break" tempfilename = None saved = self.get_saved() if saved: filename = self.filename # shell undo is reset after every prompt, looks saved, probably isn't if not saved or filename is None: (tfd, tempfilename) = tempfile.mkstemp(prefix='IDLE_tmp_') filename = tempfilename os.close(tfd) if not self.writefile(tempfilename): os.unlink(tempfilename) return "break" platform = os.name printPlatform = True if platform == 'posix': #posix platform command = idleConf.GetOption('main','General', 'print-command-posix') command = command + " 2>&1" elif platform == 'nt': #win32 platform command = idleConf.GetOption('main','General','print-command-win') else: #no printing for this platform printPlatform = False if printPlatform: #we can try to print for this platform command = command % pipes.quote(filename) pipe = os.popen(command, "r") # things can get ugly on NT if there is no printer available. output = pipe.read().strip() status = pipe.close() if status: output = "Printing failed (exit status 0x%x)\n" % \ status + output if output: output = "Printing command: %s\n" % repr(command) + output tkMessageBox.showerror("Print status", output, master=self.text) else: #no printing for this platform message = "Printing is not enabled for this platform: %s" % platform tkMessageBox.showinfo("Print status", message, master=self.text) if tempfilename: os.unlink(tempfilename) return "break"
Example #23
Source File: IOBinding.py From BinderFilter with MIT License | 4 votes |
def print_window(self, event): confirm = tkMessageBox.askokcancel( title="Print", message="Print to Default Printer", default=tkMessageBox.OK, master=self.text) if not confirm: self.text.focus_set() return "break" tempfilename = None saved = self.get_saved() if saved: filename = self.filename # shell undo is reset after every prompt, looks saved, probably isn't if not saved or filename is None: (tfd, tempfilename) = tempfile.mkstemp(prefix='IDLE_tmp_') filename = tempfilename os.close(tfd) if not self.writefile(tempfilename): os.unlink(tempfilename) return "break" platform = os.name printPlatform = True if platform == 'posix': #posix platform command = idleConf.GetOption('main','General', 'print-command-posix') command = command + " 2>&1" elif platform == 'nt': #win32 platform command = idleConf.GetOption('main','General','print-command-win') else: #no printing for this platform printPlatform = False if printPlatform: #we can try to print for this platform command = command % pipes.quote(filename) pipe = os.popen(command, "r") # things can get ugly on NT if there is no printer available. output = pipe.read().strip() status = pipe.close() if status: output = "Printing failed (exit status 0x%x)\n" % \ status + output if output: output = "Printing command: %s\n" % repr(command) + output tkMessageBox.showerror("Print status", output, master=self.text) else: #no printing for this platform message = "Printing is not enabled for this platform: %s" % platform tkMessageBox.showinfo("Print status", message, master=self.text) if tempfilename: os.unlink(tempfilename) return "break"