当前位置: 首页>>代码示例>>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;未经允许,请勿转载。