當前位置: 首頁>>代碼示例>>Python>>正文


Python tkMessageBox.askokcancel方法代碼示例

本文整理匯總了Python中tkMessageBox.askokcancel方法的典型用法代碼示例。如果您正苦於以下問題:Python tkMessageBox.askokcancel方法的具體用法?Python tkMessageBox.askokcancel怎麽用?Python tkMessageBox.askokcancel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tkMessageBox的用法示例。


在下文中一共展示了tkMessageBox.askokcancel方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: format_confirm

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
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 
開發者ID:lukas2511,項目名稱:sky3ds.py,代碼行數:19,代碼來源:gui.py

示例2: validate_file_path

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
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 
開發者ID:PCWG,項目名稱:PCWG,代碼行數:23,代碼來源:base_dialog.py

示例3: ask_save_dialog

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
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 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:9,代碼來源:ScriptBinding.py

示例4: close

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
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) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:17,代碼來源:PyShell.py

示例5: close

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
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) 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:16,代碼來源:PyShell.py

示例6: askclose

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
def askclose():
    if tkMessageBox.askokcancel("Quit", "Do you really wish to exit?"):
        root.destroy() 
開發者ID:WikiTeam,項目名稱:wikiteam,代碼行數:5,代碼來源:gui.py

示例7: ask_save_dialog

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
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 
開發者ID:nccgroup,項目名稱:Splunking-Crime,代碼行數:9,代碼來源:ScriptBinding.py

示例8: close

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
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) 
開發者ID:nccgroup,項目名稱:Splunking-Crime,代碼行數:16,代碼來源:PyShell.py

示例9: ask_ok_cancel

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
def ask_ok_cancel(self, title, message):
        return messagebox.askokcancel(title, message) 
開發者ID:wynand1004,項目名稱:SPGL,代碼行數:4,代碼來源:spgl.py

示例10: exit_command

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
def exit_command(root):
    if tkMessageBox.askokcancel("Quit", "Do you really want to quit?"):
        root.destroy() 
開發者ID:SimplySecurity,項目名稱:SimplyTemplate,代碼行數:5,代碼來源:TemplateEdit.py

示例11: handler

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
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) 
開發者ID:statueofmike,項目名稱:rtsp,代碼行數:14,代碼來源:rts2.bak.py

示例12: exit_app

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
def exit_app(self):
		if tkMessageBox.askokcancel("Quit", "Do you really want to quit?"):
			self.root.destroy()
#basic UI 
開發者ID:Leohc92,項目名稱:Tkinter-Projects,代碼行數:6,代碼來源:TkDrumMachine.py

示例13: exit_editor

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
def exit_editor():
    if tkMessageBox.askokcancel("Quti", "Do you really want to quit?"):
        root.destroy() 
開發者ID:Leohc92,項目名稱:Tkinter-Projects,代碼行數:5,代碼來源:Tkeditor.py

示例14: close_player

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
def close_player(self):
		if tkMessageBox.askokcancel("Quit", "Do you really want to close quit?"):
			try:
				self.player.pause()
			except:
				pass
			self.root.destroy() 
開發者ID:Leohc92,項目名稱:Tkinter-Projects,代碼行數:9,代碼來源:main-gui.py

示例15: print_window

# 需要導入模塊: import tkMessageBox [as 別名]
# 或者: from tkMessageBox import askokcancel [as 別名]
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" 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:51,代碼來源:IOBinding.py


注:本文中的tkMessageBox.askokcancel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。