当前位置: 首页>>代码示例>>Python>>正文


Python tkMessageBox.showwarning方法代码示例

本文整理汇总了Python中tkMessageBox.showwarning方法的典型用法代码示例。如果您正苦于以下问题:Python tkMessageBox.showwarning方法的具体用法?Python tkMessageBox.showwarning怎么用?Python tkMessageBox.showwarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkMessageBox的用法示例。


在下文中一共展示了tkMessageBox.showwarning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: start_processing

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def start_processing(self):
        """Start processing."""
        if self.settings['filename_ann'].get() == '':
            messagebox.showwarning(title="Warning",
                                   message="Please specify a filename base.")
            return

        if self.settings['dataset_path'].get() == '':
            messagebox.showwarning(title="Warning",
                                   message="Please set the dataset path.")
            return

        self.store_last_settings = True
        self.save_settings()
        self.check_runlabel(self.settings['runlabel'].get())
        self.config.read_dict(self.settings)

        self.initialize_thread()
        self.process_thread.start()
        self.toggle_start_state(True)
        self.update() 
开发者ID:NeuromorphicProcessorProject,项目名称:snn_toolbox,代码行数:23,代码来源:gui.py

示例2: validate

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def validate(self):
        """
        Called when the user chooses "OK", before closing the box.

        Also checks that child name is unique.
        """
        for tk_list in self.frame_dict.values():
            if not all(x.validate() for x in tk_list):
                return False

        if self.element.parent is not None:
            if self.element not in self.element.parent.children:
                if self.name_entry.value.get() in self.element.parent.child_names():
                    tkMessageBox.showwarning("", "Sibling names must be unique.")
                    return False

        return True 
开发者ID:FowlerLab,项目名称:Enrich2,代码行数:19,代码来源:edit_dialog.py

示例3: menu_saveas

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def menu_saveas(self):
        if self.root_element is None:
            tkMessageBox.showwarning(None, "Cannot save empty configuration.")
        else:
            fname = tkFileDialog.asksaveasfilename()
            if len(fname) > 0:  # file was selected
                try:
                    with open(fname, "w") as handle:
                        write_json(self.root_element.serialize(), handle)
                except IOError:
                    tkMessageBox.showerror(None, "Failed to save config file.")
                else:
                    self.cfg_file_name.set(fname)
                    tkMessageBox.showinfo(
                        None, "Save successful:\n{}".format(self.cfg_file_name.get())
                    ) 
开发者ID:FowlerLab,项目名称:Enrich2,代码行数:18,代码来源:configurator.py

示例4: _start

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def _start(self):
        if not self.videofile:
            messagebox.showwarning('提示', '请先选择视频文件或目录')
            return

        def start(*args, **kwargs):
            subfinder = SubFinder(*args, **kwargs)
            subfinder.start()
            subfinder.done()

        subsearchers = [
            get_subsearcher('shooter'), 
            get_subsearcher('zimuku'),
            get_subsearcher('zimuzu')
        ]
        t = Thread(target=start, args=[self.videofile, ], kwargs=dict(
            logger_output=self._output, subsearcher_class=subsearchers))
        t.start() 
开发者ID:ausaki,项目名称:subfinder,代码行数:20,代码来源:app.py

示例5: screenshot_CD

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def screenshot_CD():
    pool=[]
    screenshot=ImageGrab.grab()
    rescale=float(screenshot.size[1])/1080
    aspect = 16*screenshot.size[1]/screenshot.size[0]
    if aspect not in hero_group_pixel_offsets_RD:
        tkMessageBox.showerror("Error","Aspect Ratio not supported")
        return
    for group in range(6):
        for hero_number_within_group in range(len(hero_group_table[group])):
            blockX,blockY=hero_group_pixel_offsets_CD[aspect][group]
            image = screenshot.crop((int((blockX+66*(hero_number_within_group%5)+2)*rescale), int((blockY+43*(hero_number_within_group/5)+2)*rescale),\
                                     int((blockX+66*(hero_number_within_group%5)+60-2)*rescale), int((blockY+43*(hero_number_within_group/5)+33-2)*rescale)))
            #image.show()
            stats=ImageStat.Stat(image)
            if max(stats.mean)>21: #puck is brightest at 20.85
                pool.append(hero_group_table[group][hero_number_within_group])
    if len(pool)>27 or len(pool)<11: tkMessageBox.showwarning("Warning","Warning! Number of heroes detected ("+str(len(pool))+") is wrong!")
    return pool 
开发者ID:negative-energy,项目名称:Omniscience,代码行数:21,代码来源:omniscience_methods.py

示例6: validate_file_path

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [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

示例7: nextImg

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def nextImg(self):
        """ Shows the next FF file in the list. """

        # Don't allow image change while in star picking mode
        if self.star_pick_mode:
            messagebox.showwarning(title='Star picking mode', message='You cannot cycle through images while in star picking mode!')
            return

            
        self.img_handle.nextChunk()

        # Reset paired stars
        self.paired_stars = []
        self.residuals = None

        self.updateImage() 
开发者ID:CroatianMeteorNetwork,项目名称:RMS,代码行数:18,代码来源:SkyFit.py

示例8: prevImg

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def prevImg(self):
        """ Shows the previous FF file in the list. """

        # Don't allow image change while in star picking mode
        if self.star_pick_mode:
            messagebox.showwarning(title='Star picking mode', message='You cannot cycle through images while in star picking mode!')
            return


        self.img_handle.prevChunk()

        # Reset paired stars
        self.paired_stars = []
        self.residuals = None

        self.updateImage() 
开发者ID:CroatianMeteorNetwork,项目名称:RMS,代码行数:18,代码来源:SkyFit.py

示例9: main

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def main():
    converter = DFlashConverter()
    
    root = Tkinter.Tk()
    root.withdraw()

    source_path = tkFileDialog.askopenfilename()
    try:
        converter._read_file(source_path)
    except Exception as error:
        tkMessageBox.showerror(title="Error reading file", message=str(error))
        return -1
    
    try:
        converter._find_endblock()
    except Exception as error:
        tkMessageBox.showerror(title="Error converting file", message=str(error))
        return -1
    
    dest_path = tkFileDialog.asksaveasfilename()
    try:
        converter._save_file(dest_path)
    except Exception as error:
        tkMessageBox.showerror(title="Error saving file", message=str(error))
        return -1

    tkMessageBox.showinfo(title="Conversion complete", message=converter._get_info())

    tkMessageBox.showwarning(title="Warning", message=USER_NOTES) 
开发者ID:tomvleeuwen,项目名称:dflash_to_eeprom,代码行数:31,代码来源:gui.py

示例10: validate

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def validate(self):

        import tkMessageBox

        try:
            result = self.getresult()
        except ValueError:
            tkMessageBox.showwarning(
                "Illegal value",
                self.errormessage + "\nPlease try again",
                parent = self
            )
            return 0

        if self.minvalue is not None and result < self.minvalue:
            tkMessageBox.showwarning(
                "Too small",
                "The allowed minimum value is %s. "
                "Please try again." % self.minvalue,
                parent = self
            )
            return 0

        if self.maxvalue is not None and result > self.maxvalue:
            tkMessageBox.showwarning(
                "Too large",
                "The allowed maximum value is %s. "
                "Please try again." % self.maxvalue,
                parent = self
            )
            return 0

        self.result = result

        return 1 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:37,代码来源:tkSimpleDialog.py

示例11: clientConnectionFailed

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def clientConnectionFailed(self, connector, reason):
        tkMessageBox.showwarning('TkConch','Connection Failed, Reason:\n %s: %s' % (reason.type, reason.value)) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:4,代码来源:tkconch.py

示例12: check_file

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def check_file(self, p):
        """Check files."""
        if not os.path.exists(self.settings['path_wd'].get()) or \
                not any(p in fname for fname in
                        os.listdir(self.settings['path_wd'].get())):
            msg = ("Failed to set filename base:\n"
                   "Either working directory does not exist or contains no "
                   "files with base name \n '{}'".format(p))
            messagebox.showwarning(title="Warning", message=msg)
            return False
        else:
            return True 
开发者ID:NeuromorphicProcessorProject,项目名称:snn_toolbox,代码行数:14,代码来源:gui.py

示例13: check_path

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def check_path(self, p):
        """Check path."""
        if not self.initialized:
            result = True
        elif not os.path.exists(p):
            msg = "Failed to set working directory:\n" + \
                  "Specified directory does not exist."
            messagebox.showwarning(title="Warning", message=msg)
            result = False
        elif self.settings['model_lib'].get() == 'caffe':
            if not any(fname.endswith('.caffemodel') for fname in
                       os.listdir(p)):
                msg = "No '*.caffemodel' file found in \n {}".format(p)
                messagebox.showwarning(title="Warning", message=msg)
                result = False
            elif not any(fname.endswith('.prototxt') for fname in
                         os.listdir(p)):
                msg = "No '*.prototxt' file found in \n {}".format(p)
                messagebox.showwarning(title="Warning", message=msg)
                result = False
            else:
                result = True
        elif not any(fname.endswith('.json') for fname in os.listdir(p)):
            msg = "No model file '*.json' found in \n {}".format(p)
            messagebox.showwarning(title="Warning", message=msg)
            result = False
        else:
            result = True

        if result:
            self.settings['path_wd'].set(p)
            self.gui_log.set(os.path.join(p, 'log', 'gui'))
            # Look for plots in working directory to display
            self.graph_widgets()

        return result 
开发者ID:NeuromorphicProcessorProject,项目名称:snn_toolbox,代码行数:38,代码来源:gui.py

示例14: check_dataset_path

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def check_dataset_path(self, p):
        """

        Parameters
        ----------
        p :

        Returns
        -------

        """
        if not self.initialized:
            result = True
        elif not os.path.exists(p):
            msg = "Failed to set dataset directory:\n" + \
                  "Specified directory does not exist."
            messagebox.showwarning(title="Warning", message=msg)
            result = False
        elif self.settings['normalize'] and \
                self.settings['dataset_format'] == 'npz' and not \
                os.path.exists(os.path.join(p, 'x_norm.npz')):
            msg = "No data set file 'x_norm.npz' found.\n" + \
                  "Add it, or disable normalization."
            messagebox.showerror(title="Error", message=msg)
            result = False
        elif self.settings['dataset_format'] == 'npz' and not \
                (os.path.exists(os.path.join(p, 'x_test.npz')) and
                 os.path.exists(os.path.join(p, 'y_test.npz'))):
            msg = "Data set file 'x_test.npz' or 'y_test.npz' was not found."
            messagebox.showerror(title="Error", message=msg)
            result = False
        else:
            result = True

        if result:
            self.settings['dataset_path'].set(p)

        return result 
开发者ID:NeuromorphicProcessorProject,项目名称:snn_toolbox,代码行数:40,代码来源:gui.py

示例15: validate

# 需要导入模块: import tkMessageBox [as 别名]
# 或者: from tkMessageBox import showwarning [as 别名]
def validate(self):
        """
        Validates the input. Returns ``True`` unless the field is blank and
        *optional* is ``False``.
        """
        if not self.enabled:
            return True
        elif not self.optional and len(self.value.get()) == 0:
            tkMessageBox.showwarning("", "{} not specified.".format(self.text))
            return False
        else:
            return True 
开发者ID:FowlerLab,项目名称:Enrich2,代码行数:14,代码来源:dialog_elements.py


注:本文中的tkMessageBox.showwarning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。