Python tkMessageBox 模块,showwarning() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用tkMessageBox.showwarning()

项目:PiJuice    作者:PiSupply    | 项目源码 | 文件源码
def _UpdateFirmwareCmd(self):
        q = tkMessageBox.showwarning('Update Fimware','Warning! Interrupting firmare update may lead to non functional PiJuice HAT.', parent=self.frame)
        if q:
            print 'Updating fimware'
            inputFile = '/usr/share/pijuice/data/firmware/PiJuice.elf.binary'
            curAdr = pijuice.config.interface.GetAddress()
            if curAdr:
                adr = format(curAdr, 'x')
                ret = 256 - subprocess.call(['pijuiceboot', adr, inputFile])#subprocess.call([os.getcwd() + '/stmboot', adr, inputFile])
                print 'firm res', ret 
                if ret == 256:
                    tkMessageBox.showinfo('Firmware update', 'Finished succesfully!', parent=self.frame)
                else:
                    errorStatus = self.firmUpdateErrors[ret] if ret < 11 else ' UNKNOWN'
                    msg = ''
                    if errorStatus == 'I2C_BUS_ACCESS_ERROR':
                        msg = 'Check if I2C bus is enabled.'
                    elif errorStatus == 'INPUT_FILE_OPEN_ERROR':
                        msg = 'Firmware binary file might be missing or damaged.'
                    elif errorStatus == 'STARTING_BOOTLOADER_ERROR':
                        msg = 'Try to start bootloader manualy. Press and hold button SW3 while powering up RPI and PiJuice.'
                    tkMessageBox.showerror('Firmware update failed', 'Reason: ' + errorStatus + '. ' + msg, parent=self.frame)
            else:
                tkMessageBox.showerror('Firmware update', 'Unknown pijuice I2C address', parent=self.frame)
项目:PiJuice    作者:PiSupply    | 项目源码 | 文件源码
def _UpdateFirmwareCmd(self):
        q = tkMessageBox.showwarning('Update Fimware','Warning! Interrupting firmare update may lead to non functional PiJuice HAT.', parent=self.frame)
        if q:
            print 'Updating fimware'
            inputFile = '/usr/share/pijuice/data/firmware/PiJuice.elf.binary'
            curAdr = pijuice.config.interface.GetAddress()
            if curAdr:
                adr = format(curAdr, 'x')
                ret = 256 - subprocess.call(['pijuiceboot', adr, inputFile])#subprocess.call([os.getcwd() + '/stmboot', adr, inputFile])
                print 'firm res', ret 
                if ret == 256:
                    tkMessageBox.showinfo('Firmware update', 'Finished succesfully!', parent=self.frame)
                else:
                    errorStatus = self.firmUpdateErrors[ret] if ret < 11 else ' UNKNOWN'
                    msg = ''
                    if errorStatus == 'I2C_BUS_ACCESS_ERROR':
                        msg = 'Check if I2C bus is enabled.'
                    elif errorStatus == 'INPUT_FILE_OPEN_ERROR':
                        msg = 'Firmware binary file might be missing or damaged.'
                    elif errorStatus == 'STARTING_BOOTLOADER_ERROR':
                        msg = 'Try to start bootloader manualy. Press and hold button SW3 while powering up RPI and PiJuice.'
                    tkMessageBox.showerror('Firmware update failed', 'Reason: ' + errorStatus + '. ' + msg, parent=self.frame)
            else:
                tkMessageBox.showerror('Firmware update', 'Unknown pijuice I2C address', parent=self.frame)
项目:PiJuice    作者:PiSupply    | 项目源码 | 文件源码
def _UpdateFirmwareCmd(self):
        q = tkMessageBox.showwarning('Update Fimware','Warning! Interrupting firmare update may lead to non functional PiJuice HAT.', parent=self.frame)
        if q:
            print 'Updating fimware'
            inputFile = '/usr/share/pijuice/data/firmware/PiJuice.elf.binary'
            curAdr = pijuice.config.interface.GetAddress()
            if curAdr:
                adr = format(curAdr, 'x')
                ret = 256 - subprocess.call(['pijuiceboot', adr, inputFile])#subprocess.call([os.getcwd() + '/stmboot', adr, inputFile])
                print 'firm res', ret 
                if ret == 256:
                    tkMessageBox.showinfo('Firmware update', 'Finished succesfully!', parent=self.frame)
                else:
                    errorStatus = self.firmUpdateErrors[ret] if ret < 11 else ' UNKNOWN'
                    msg = ''
                    if errorStatus == 'I2C_BUS_ACCESS_ERROR':
                        msg = 'Check if I2C bus is enabled.'
                    elif errorStatus == 'INPUT_FILE_OPEN_ERROR':
                        msg = 'Firmware binary file might be missing or damaged.'
                    elif errorStatus == 'STARTING_BOOTLOADER_ERROR':
                        msg = 'Try to start bootloader manualy. Press and hold button SW3 while powering up RPI and PiJuice.'
                    tkMessageBox.showerror('Firmware update failed', 'Reason: ' + errorStatus + '. ' + msg, parent=self.frame)
            else:
                tkMessageBox.showerror('Firmware update', 'Unknown pijuice I2C address', parent=self.frame)
项目:PiJuice    作者:PiSupply    | 项目源码 | 文件源码
def _UpdateFirmwareCmd(self):
        q = tkMessageBox.showwarning('Update Fimware','Warning! Interrupting firmare update may lead to non functional PiJuice HAT.', parent=self.frame)
        if q:
            print 'Updating fimware'
            inputFile = '/usr/share/pijuice/data/firmware/PiJuice.elf.binary'
            curAdr = pijuice.config.interface.GetAddress()
            if curAdr:
                adr = format(curAdr, 'x')
                ret = 256 - subprocess.call(['pijuiceboot', adr, inputFile])#subprocess.call([os.getcwd() + '/stmboot', adr, inputFile])
                print 'firm res', ret 
                if ret == 256:
                    tkMessageBox.showinfo('Firmware update', 'Finished succesfully!', parent=self.frame)
                else:
                    errorStatus = self.firmUpdateErrors[ret] if ret < 11 else ' UNKNOWN'
                    msg = ''
                    if errorStatus == 'I2C_BUS_ACCESS_ERROR':
                        msg = 'Check if I2C bus is enabled.'
                    elif errorStatus == 'INPUT_FILE_OPEN_ERROR':
                        msg = 'Firmware binary file might be missing or damaged.'
                    elif errorStatus == 'STARTING_BOOTLOADER_ERROR':
                        msg = 'Try to start bootloader manualy. Press and hold button SW3 while powering up RPI and PiJuice.'
                    tkMessageBox.showerror('Firmware update failed', 'Reason: ' + errorStatus + '. ' + msg, parent=self.frame)
            else:
                tkMessageBox.showerror('Firmware update', 'Unknown pijuice I2C address', parent=self.frame)
项目:PiJuice    作者:PiSupply    | 项目源码 | 文件源码
def _UpdateFirmwareCmd(self):
        q = tkMessageBox.showwarning('Update Fimware','Warning! Interrupting firmare update may lead to non functional PiJuice HAT.', parent=self.frame)
        if q:
            print 'Updating fimware'
            inputFile = '/usr/share/pijuice/data/firmware/PiJuice.elf.binary'
            curAdr = pijuice.config.interface.GetAddress()
            if curAdr:
                adr = format(curAdr, 'x')
                ret = 256 - subprocess.call(['pijuiceboot', adr, inputFile])#subprocess.call([os.getcwd() + '/stmboot', adr, inputFile])
                print 'firm res', ret 
                if ret == 256:
                    tkMessageBox.showinfo('Firmware update', 'Finished succesfully!', parent=self.frame)
                else:
                    errorStatus = self.firmUpdateErrors[ret] if ret < 11 else ' UNKNOWN'
                    msg = ''
                    if errorStatus == 'I2C_BUS_ACCESS_ERROR':
                        msg = 'Check if I2C bus is enabled.'
                    elif errorStatus == 'INPUT_FILE_OPEN_ERROR':
                        msg = 'Firmware binary file might be missing or damaged.'
                    elif errorStatus == 'STARTING_BOOTLOADER_ERROR':
                        msg = 'Try to start bootloader manualy. Press and hold button SW3 while powering up RPI and PiJuice.'
                    tkMessageBox.showerror('Firmware update failed', 'Reason: ' + errorStatus + '. ' + msg, parent=self.frame)
            else:
                tkMessageBox.showerror('Firmware update', 'Unknown pijuice I2C address', parent=self.frame)
项目:pymod    作者:pymodproject    | 项目源码 | 文件源码
def show_popup_message(self, popup_type="warning", title_to_show="ALLERT", message_to_show="THIS IS AN ALLERT MESSAGE", parent_window=None, refresh=True):
        """
        Displays error or warning messages and refreshes the sequence window.
        """
        # show_error_message
        # show_warning_message
        if parent_window == None:
            parent_window = self.main_window

        if popup_type == "error":
            tkMessageBox.showerror(title_to_show, message_to_show, parent=parent_window)
        elif popup_type == "info":
            tkMessageBox.showinfo(title_to_show, message_to_show, parent=parent_window)
        elif popup_type == "warning":
            tkMessageBox.showwarning(title_to_show, message_to_show, parent=parent_window)

        if refresh:
            self.gridder()
项目:data-analysis    作者:ymohanty    | 项目源码 | 文件源码
def handleLinearRegression(self):
        if self.data is None:
            tkMessageBox.showerror("No Open File", "Please open a file first!")
            return
        d = LinearRegressionDialog(self.root, self.data.get_headers())
        if d.result is not None:
            if d.result[0] == "None" or d.result[1] == "None":
                tkMessageBox.showwarning(title="Incorrect Parameters", message="Option cannot be 'None'")
            else:
                self.objects = []
                self.linreg_endpoints = None
                self.linreg_line_objects = []
                self.reset()
                self.updateAxes()
                self.regression_mode = True
                self.buildLinearRegression(headers=d.result)

    # build and display the regression on the plot
项目:data-analysis    作者:ymohanty    | 项目源码 | 文件源码
def handlePCA(self, event=None):
        if self.data is None:
            tkMessageBox.showerror("No File Open", "Please open a file first!")
            return
        d = PCADialog(self.root, self.data.get_headers())
        if d.result is None:
            return
        if d.result[2] in self.pca_data.keys():
            tkMessageBox.showwarning("Replacing Saved Analysis",
                                     "Please delete old analysis before creating another with the same name.")
            return
        if d.result[0] == 1:
            self.pca_data[d.result[2]] = analysis.pca(self.data, d.result[1])
            self.pca_data[d.result[2]].write_to_file(d.result[2], self.pca_data[d.result[2]].get_headers())
            print "Normalizing: True"
        else:
            self.pca_data[d.result[2]] = analysis.pca(self.data, d.result[1], False)
            self.pca_data[d.result[2]].write_to_file(d.result[2], self.pca_data[d.result[2]].get_headers())
            print "Normalizing: False"
        if not self.pca_controls_built:
            self.buildPCAControls()

        self.pca_lbox.insert(tk.END, d.result[2])
项目:Enrich2    作者:FowlerLab    | 项目源码 | 文件源码
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
项目:Enrich2    作者:FowlerLab    | 项目源码 | 文件源码
def new_button_press(self):
        if self.treeview.focus() == "" and self.root_element is not None:
            tkMessageBox.showwarning(None, "No parent element selected.")
        else: 
            if self.treeview.focus() == "" and self.root_element is None:
                element = CreateRootDialog(self).element
                if isinstance(element, SeqLib):
                    EditDialog(self, self, element)
                self.root_element = element
            else:
                element = self.create_new_element()
                EditDialog(self, self, element)

            # refresh the treeview and re-assign treeview id's
            self.refresh_treeview()

            # select the newly added element if it was successfully added
            if element.treeview_id in self.element_dict.keys():
                self.treeview.focus(element.treeview_id)
                self.treeview.selection_set(element.treeview_id)
            else:
                if element.parent is not None:
                    self.treeview.focus(element.parent.treeview_id)
                    self.treeview.selection_set(element.parent.treeview_id)
                del element
项目:SceneDensity    作者:ImOmid    | 项目源码 | 文件源码
def warningBox(self, title, message):
        self.topLevel.update_idletasks()
        MessageBox.showwarning(title, message)
        self.__bringToFront()
项目:AWS-SSL-Manager    作者:adaranutsa    | 项目源码 | 文件源码
def warning(self, title, message):
        messagebox.showwarning(title, message)
项目:darkc0de-old-stuff    作者:tuwid    | 项目源码 | 文件源码
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
项目:darkc0de-old-stuff    作者:tuwid    | 项目源码 | 文件源码
def callback(self):
        tkMessageBox.showwarning(title="Not Implemented", message="This feature has not yet been implemented")
项目:uhg-plancheck    作者:jsfrench    | 项目源码 | 文件源码
def check_NumBeams(LPlan,OTPPlan,passLog,failLog):
    # Check same number of beams
    #print LPlan.NumBeams,OTPPlan.NumBeams
    if not (LPlan.NumBeams == OTPPlan.NumBeams):
        tkMessageBox.showwarning(
        "Mismatch", 
        "Plans contain unequal number of beams" 
         )
        return False
    else:
        return True
项目:Cryptokey_Generator    作者:8BitCookie    | 项目源码 | 文件源码
def warningBox(self, title, message):
        self.topLevel.update_idletasks()
        MessageBox.showwarning(title, message)
        self.__bringToFront()
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def clientConnectionFailed(self, connector, reason):
        tkMessageBox.showwarning('TkConch','Connection Failed, Reason:\n %s: %s' % (reason.type, reason.value))
项目:nao_slam_amcl    作者:hu7241    | 项目源码 | 文件源码
def MsgBox(title, text, style):
    box = [
        msg.showinfo,       msg.showwarning,    msg.showerror,
        msg.askquestion,    msg.askyesno,       msg.askokcancel,        msg.askretrycancel,
    ];
    tk.Tk().withdraw(); #Hide Main Window.
    if style in range(7):
        return box[style](title, text)
项目:nao_slam_amcl    作者:hu7241    | 项目源码 | 文件源码
def MsgBox(title, text, style):
    box = [
        msg.showinfo,       msg.showwarning,    msg.showerror,
        msg.askquestion,    msg.askyesno,       msg.askokcancel,        msg.askretrycancel,
    ];
    tk.Tk().withdraw(); #Hide Main Window.
    if style in range(7):
        return box[style](title, text)
项目:SPGL    作者:wynand1004    | 项目源码 | 文件源码
def show_warning(self, title, message):
        return messagebox.showwarning(title, message)
项目:SPGL    作者:wynand1004    | 项目源码 | 文件源码
def show_warning(self, title, message):
        return messagebox.showwarning(title, message)
项目:Tweezer_design    作者:AntoineRiaud    | 项目源码 | 文件源码
def read_path_from_svg(svg_filename):
   # re_split = re.compile('\s+|,')
    try:
        tree = etree.parse(open(svg_filename))
    except (OSError, IOError):
        tkMessageBox.showwarning(title = 'Error during reticule import',message = "the file %s was not found" %svg_filename)   
    path_list = [];
    for element in tree.iter():
        if element.tag.split("}")[1] == "path":
            #re_split.split(element.get("d"))
            path_list.append(element.get('d'))
            #path_list.append(re_split)  
    Points = string2points(path_list)
    return Points
项目:Tweezer_design    作者:AntoineRiaud    | 项目源码 | 文件源码
def read_colored_path_from_svg(svg_filename):
   # re_split = re.compile('\s+|,')
    tree = etree.parse(open(svg_filename))
    path_list = {}
    for element in tree.iter():
        if element.tag.split("}")[1] == "path":
            #re_split.split(element.get("d"))
            path_color = element.get('style')
            if type(path_color) == str:
                ind = path_color.find('fill:')
                path_color = path_color[(ind+5):(ind+12)]
                if path_color == '#ff0000':
                    path_color = 'red'
                elif path_color == '#00ff00':
                    path_color = 'green'
                elif path_color == '#0000ff':
                    path_color = 'blue'
                else:
                    tkMessageBox.showwarning('Some colors were not rekognized', 'Only blue, red and green traces are imported')
            else:
                path_color = element.get('fill')
            if path_color not in path_list.keys():
                path_list[path_color]=[]
            path_list[path_color].append(element.get('d'))
            #path_list.append(re_split)
    Points = {}
    for path_color in path_list:        
        Points[path_color] = string2points(path_list[path_color])
    return Points
项目:Tweezer_design    作者:AntoineRiaud    | 项目源码 | 文件源码
def importSVGroute(IDT_group):
    IDT_group_dir = IDT_group['IDT_group_dir']
    Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
    svg_filename = tkFileDialog.askopenfilename(title='Wafer routing filename',defaultextension = 'svg',initialdir = IDT_group_dir);
    all_points = SVGT.read_colored_path_from_svg(svg_filename)
    route =[[],[]]
    for points in all_points['red']:
        polygon = shapely_geom.Polygon(points.T)
        polygon_validity = explain_validity(polygon)
        if polygon_validity=='Valid Geometry':
            route[0].append(polygon)
        else:
            tkMessageBox.showwarning('Error in svg import', polygon_validity)
    for points in all_points['blue']:
        polygon = shapely_geom.Polygon(points.T)
        polygon_validity = explain_validity(polygon)
        if polygon_validity=='Valid Geometry':
            route[1].append(polygon)
        else:
            tkMessageBox.showwarning('Error in svg import', polygon_validity)
    route[0] = shapely_geom.MultiPolygon(route[0])
    route[1] = shapely_geom.MultiPolygon(route[1])
    #outbox = route[0].bounds
    #dx = outbox[2]-outbox[0]
    #dy = outbox[3]-outbox[1]
    #x0 = outbox[0]+dx/2
    #y0 = outbox[1]+dy/2
    x0 = 4000
    y0 = 4000
    factor = 1e-5;
    route[0] = shapely_affinity.translate(route[0], xoff=-x0, yoff=-y0) 
    route[0] = shapely_affinity.scale(route[0], xfact = factor, yfact= factor, origin=(0,0,0))
    route[1] = shapely_affinity.translate(route[1], xoff=-x0, yoff=-y0) 
    route[1] = shapely_affinity.scale(route[1], xfact = factor, yfact= factor, origin=(0,0,0))
    IDT_group['route'] = route
项目:heartbreaker    作者:lokori    | 项目源码 | 文件源码
def checkIPaddr(self,addr):
        try:
            socket.inet_pton(socket.AF_INET,addr)
            return True
        except socket.error:
            tkMessageBox.showwarning("Error","Invalid Target IP Address\n(%s)" % addr)
            return False
项目:ecel    作者:ARL-UTEP-OC    | 项目源码 | 文件源码
def callback(self):
        tkMessageBox.showwarning(title="Not Implemented", 
                    message="This feature has not yet been implemented")
项目:oil    作者:oilshell    | 项目源码 | 文件源码
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
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
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
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def clientConnectionFailed(self, connector, reason):
        tkMessageBox.showwarning('TkConch','Connection Failed, Reason:\n %s: %s' % (reason.type, reason.value))
项目:pymod    作者:pymodproject    | 项目源码 | 文件源码
def add_new_user_disulfide(self):

        # Checks that both the comboboxes have been used to select a cys.
        if (self.list_of_disulfide_combos[-1].cys1_combobox.get() == "" or self.list_of_disulfide_combos[-1].cys2_combobox.get() == ""):
            txt = "You have to select two cysteines residue to define a disulfide bridge!"
            tkMessageBox.showwarning("Warning", txt,parent=self.pymod_object.modeling_window)

        # Checks that the same cys has not been selected in both comboboxes.
        elif (self.list_of_disulfide_combos[-1].cys1_combobox.get() == self.list_of_disulfide_combos[-1].cys2_combobox.get()):
            txt = "You cannot select the same cysteine to form a disulfide bridge!"
            tkMessageBox.showwarning("Message", txt,parent=self.pymod_object.modeling_window)

        # Checks that the selected cys are not engaged in other bridges.
        # ...

        # If the two cys are free to form a bridge, then adds the new bridge and updates the
        # frame with a new combobox row.
        else:
            self.user_disulfides_row_counter += 1
            # Adds the new row with comboboxes and an "Add" button.
            new_ds_combo = User_disulfide_combo(
                self.pymod_object,
                self.user_disulfides_row_counter,
                self.target_list_of_cysteines,
                self.combobox_frame,
                self)
            # Activates the previous row and returns the name of the 2 selected cys.
            cysteines = self.list_of_disulfide_combos[-1].activate()
            # Finishes and adds the new row.
            self.list_of_disulfide_combos.append(new_ds_combo)
            # Adds the cys pair to the self.user_defined_disulfide_bridges, which is going to be
            # used in the perform_modelization() method.
            self.user_defined_disulfide_bridges.append(cysteines)
            # self.print_user_ds_list()
        self.pymod_object.disulfides_scrolled_frame.reposition()


    # This is called when the "Remove" button is pressed.
项目:BeachedWhale    作者:southpaw5271    | 项目源码 | 文件源码
def warningBox(self, title, message):
        self.topLevel.update_idletasks()
        MessageBox.showwarning(title, message)
        self.__bringToFront()
项目:data-analysis    作者:ymohanty    | 项目源码 | 文件源码
def handleOpen(self, event=None):
        fn = tkFileDialog.askopenfilename(parent=self.root, title="Choose a Data file", initialdir='.')
        if fn.split('.')[1] != "csv" and fn.split('.')[1] != "xls":
            tkMessageBox.showwarning("Open File", "Cannot open this file\n(%s)" % fn)
            return
        self.data = dt.Data(filename=fn)
        self.handlePlotData()
        self.filename = fn

    # allows users to choose which features from the data are to be displayed
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
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
项目:Farmbot_GeneralAP    作者:SpongeYao    | 项目源码 | 文件源码
def apply(self):
        try:
            self.result=[]
            for i in range(1, len(self.__entries_Func)):
                r1, r2= self.__entries_Func[i].get(), self.__entries_PinNumb[i].get()
                if r1 != '' and r2 != '':
                    self.result.append([r1,int(r2)])
            #print 'result:', self.result
            print 'End of dialog' # or something
        except ValueError:
            tkMessageBox.showwarning("Bad input","Illegal values, please try again")
项目:Farmbot_GeneralAP    作者:SpongeYao    | 项目源码 | 文件源码
def apply(self):
        try:
            spd_X = int(self.entry_Speed_X.get())
            acc_X = int(self.entry_Acc_X.get())
            spd_Y = int(self.entry_Speed_Y.get())
            acc_Y = int(self.entry_Acc_Y.get())
            spd_Z = int(self.entry_Speed_Z.get())
            acc_Z = int(self.entry_Acc_Z.get())

            self.result= spd_X, acc_X, spd_Y, acc_Y, spd_Z, acc_Z
            print spd_X, spd_Y, spd_Z # or something
        except ValueError:
            tkMessageBox.showwarning("Bad input","Illegal values, please try again")
项目:Farmbot_GeneralAP    作者:SpongeYao    | 项目源码 | 文件源码
def apply(self):
        try:
            self.__cameraID = int(self.entry_cameraID.get())

            self.result= self.__cameraID
            print self.result # or something
        except ValueError:
            tkMessageBox.showwarning("Bad input","Illegal values, please try again")
项目:pyry3d_chimera_extension    作者:mdobrychlop    | 项目源码 | 文件源码
def start_clustering(self):
        try:
            self.update_status("blue", "PLEASE WAIT. CLUSTERING IN PROGRESS...")
            infolder = self.p6_input_entry.getvalue()
            score_type = self.p6_scoretype_menu.getvalue()
            density_map = self.p6_map_entry.getvalue()
            density_map_threshold = self.p6_thresh_entry.getvalue()
            measure = self.p6_measuretype_menu.getvalue()
            threshold = self.p6_clusthresh_entry.getvalue()
            struct_nr = self.p6_numstruct_entry.getvalue()
            representation = self.p6_representation_menu.getvalue()
            output = self.p6_output_entry.getvalue()

            if self.oligos.get() == 1:
                oligomers = "oligo"
            else:
                oligomers = None

            if self.clustsort.get() == 1:
                sort_num = int(self.p6_clustsort_entry.getvalue())
            else:
                sort_num = None

            start_clustering(
                    infolder, score_type, density_map,
                    density_map_threshold, measure, threshold,
                    struct_nr, representation, output,
                    oligomers, sort_num
                    )
            self.update_status("lime green", "Ready")

            tkMessageBox.showinfo(
                    "Success",
                    "Clustering results files can be found in " + output
                    )

        except Exception as e:
            tkMessageBox.showwarning("Error", e)
            self.update_status("lime green", "Ready")
项目:gozbruh    作者:LumaPictures    | 项目源码 | 文件源码
def error_gui(message):
        """Simple tkinter gui for displaying errors
        """
        tkMessageBox.showwarning('gozbruh Error:', message)
项目:temporal-planning    作者:aig-upf    | 项目源码 | 文件源码
def load_GUI_resources():
    "Load all extra modules and methods used by GUI"
    global askopenfilename, showinfo, showwarning, showerror, Tkinter
    from tkFileDialog import askopenfilename
    from tkMessageBox import showinfo,showwarning,showerror
    import Tkinter
项目:zenchmarks    作者:squeaky-pl    | 项目源码 | 文件源码
def clientConnectionFailed(self, connector, reason):
        tkMessageBox.showwarning('TkConch','Connection Failed, Reason:\n %s: %s' % (reason.type, reason.value))
项目:fast-downward    作者:danfis    | 项目源码 | 文件源码
def load_GUI_resources():
    "Load all extra modules and methods used by GUI"
    global askopenfilename, showinfo, showwarning, showerror, Tkinter
    from tkFileDialog import askopenfilename
    from tkMessageBox import showinfo,showwarning,showerror
    import Tkinter
项目:Enrich2    作者:FowlerLab    | 项目源码 | 文件源码
def go_button_press(self):
        if self.root_element is None:
            tkMessageBox.showwarning("", "No experimental design specified.")
        else:
            RunnerSavePrompt(self)
            RunnerWindow(self)
项目:Enrich2    作者:FowlerLab    | 项目源码 | 文件源码
def edit_button_press(self):
        if self.treeview.focus() == "":
            tkMessageBox.showwarning(None, "No element selected.")
        else:
            EditDialog(self, self, self.get_focused_element())
项目:Enrich2    作者:FowlerLab    | 项目源码 | 文件源码
def menu_save(self):
        if len(self.cfg_file_name.get()) == 0:
            self.menu_saveas()
        elif self.root_element is None:
            tkMessageBox.showwarning(None, "Cannot save empty configuration.")
        else:
            try:
                with open(self.cfg_file_name.get(), "w") as handle:
                    write_json(self.root_element.serialize(), handle)
            except IOError:
                tkMessageBox.showerror(None, "Failed to save config file.")
            else:
                tkMessageBox.showinfo(None, "Save successful:\n{}".format(self.cfg_file_name.get()))
项目:Enrich2    作者:FowlerLab    | 项目源码 | 文件源码
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()))
项目:Enrich2    作者:FowlerLab    | 项目源码 | 文件源码
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
项目:Enrich2    作者:FowlerLab    | 项目源码 | 文件源码
def validate(self):
        if not self.enabled:
            return True
        elif len(self.value.get()) == 0:
            if not self.optional:
                tkMessageBox.showwarning("",
                                         "{} not specified.".format(self.text))
                return False
            else:
                return True
        else:
            if os.path.exists(self.value.get()):
                if self.extensions is not None:
                    if any(self.value.get().lower().endswith(x) for x in
                           self.extensions):
                        return True
                    else:
                        tkMessageBox.showwarning("", "Invalid file extension "
                                                 "for {}.".format(self.text))
                        return False
                else:  # no extension restriction
                    return True
            else:
                tkMessageBox.showwarning("", "{} file does not exist."
                                         "".format(self.text))
                return False
项目:Enrich2    作者:FowlerLab    | 项目源码 | 文件源码
def validate(self):
        """
        Returns ``True`` if the value entered validates; else ``False``.

        If *self.optional* is ``True``, the field can be empty.
        Checks the *self.minvalue* that was passed on creation.
        """
        if not self.enabled:
            return True
        else:
            try:
                intvalue = int(self.value.get())
            except ValueError:
                if len(self.value.get()) == 0:
                    if not self.optional:
                        tkMessageBox.showwarning("", "{} not specified."
                                                 "".format(self.text))
                        return False
                    else:
                        return True
                else:
                    tkMessageBox.showwarning("", "{} is not an integer."
                                             "".format(self.text))
                    return False
            else:
                if intvalue < self.minvalue:
                    tkMessageBox.showwarning("", "{} lower than minimum value "
                                             "({}).".format(self.text,
                                                            self.minvalue))
                    return False
                else:
                    return True
项目:MetaXcan    作者:hakyimlab    | 项目源码 | 文件源码
def checkClearToRun(self):
        # sane = checkSubdirectorySanity(self.cwd, self.beta_folder)
        # if not sane:
        #     tkMessageBox.showwarning( "Beta Folder", "Beta folder cannot be current directory, or ancestor.")
        #     return False

        # clear, message, clean_up_beta, clean_up_results = self.checkGenerated()
        # if not clear:
        #     answer = tkMessageBox.askokcancel(TS("Warning!"), message, icon=tkMessageBox.ERROR)
        #     if answer:
        #         self.cleanUpGenerated(clean_up_beta, clean_up_results)
        #     else:
        #         return False

        return True
项目:VideoStream-python    作者:ninerdb    | 项目源码 | 文件源码
def connectToServer(self):

        """Connect to the Server. Start a new RTSP/TCP session."""

        self.rtspSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

        try:

            self.rtspSocket.connect((self.serverAddr, self.serverPort))

        except:

            tkMessageBox.showwarning('Connection Failed', 'Connection to \'%s\' failed.' %self.serverAddr)