Python tkMessageBox.showwarning() Examples
The following are 30
code examples of tkMessageBox.showwarning().
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: gui.py From snn_toolbox with MIT License | 7 votes |
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()
Example #2
Source File: SkyFit.py From RMS with GNU General Public License v3.0 | 6 votes |
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()
Example #3
Source File: configurator.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()) )
Example #4
Source File: app.py From subfinder with MIT License | 6 votes |
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()
Example #5
Source File: edit_dialog.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 6 votes |
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
Example #6
Source File: omniscience_methods.py From Omniscience with MIT License | 6 votes |
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
Example #7
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 #8
Source File: SkyFit.py From RMS with GNU General Public License v3.0 | 6 votes |
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()
Example #9
Source File: base_dialog.py From PCWG with MIT License | 5 votes |
def validate(self): valid = True message = "" for item in self.validations: if not item.valid: if not isinstance(item, validation.ValidateDatasets): message += "%s (%s)\r" % (item.title, item.messageLabel['text']) else: message += "Datasets error. \r" valid = False if not valid: tkMessageBox.showwarning( "Validation errors", "Illegal values, please review error messages and try again:\r%s" % message ) return 0 else: return 1
Example #10
Source File: spgl.py From Projects with GNU General Public License v3.0 | 5 votes |
def show_warning(self, title, message): return messagebox.showwarning(title, message)
Example #11
Source File: rts2.bak.py From rtsp with MIT License | 5 votes |
def openRtpPort(self): """Open RTP socket binded to a specified port.""" #------------- # TO COMPLETE #------------- # Create a new datagram socket to receive RTP packets from the server # self.rtpSocket = ... # Set the timeout value of the socket to 0.5sec # ... self.rtpSocket.settimeout(0.5) # try: # Bind the socket to the address using the RTP port given by the client user # ... # except: # tkMessageBox.showwarning('Unable to Bind', 'Unable to bind PORT=%d' %self.rtpPort) try: #self.rtpSocket.connect(self.serverAddr,self.rtpPort) self.rtpSocket.bind((self.serverAddr,self.rtpPort)) # WATCH OUT THE ADDRESS FORMAT!!!!! rtpPort# should be bigger than 1024 #self.rtpSocket.listen(5) print "Bind RtpPort Success" except: tkMessageBox.showwarning('Connection Failed', 'Connection to rtpServer failed...')
Example #12
Source File: rts2.bak.py From rtsp with MIT License | 5 votes |
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)
Example #13
Source File: omniscience_methods.py From Omniscience with MIT License | 5 votes |
def screenshot_RD(): 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_RD[aspect][group] offset = 64 if aspect==12 else 73 # The 4:3 icons are smaller image=screenshot.crop((int((blockX+offset*(hero_number_within_group%7)+2)*rescale), int((blockY+offset*(hero_number_within_group/7))*rescale),\ int((blockX+offset*(hero_number_within_group%7)+51)*rescale), int((blockY+offset*(hero_number_within_group/7)+51)*rescale))) #image.show() brightness=max(ImageStat.Stat(image).mean) hero_id = hero_group_table[group][hero_number_within_group] if heroes[hero_id]=="Spectre": brightness+=25 # Spectre is super dark elif heroes[hero_id]=="Puck" or heroes[hero_id]=="Io": # Puck and Io are very bright brightness-=10 if brightness>45: pool.append(hero_id) if brightness>35 and brightness<55: print heroes[hero_id],brightness if len(pool)>24 or len(pool)<14: tkMessageBox.showwarning("Warning","Warning! Number of heroes detected ("+str(len(pool))+") is wrong!") return pool # Analyze a Captains Draft screenshot
Example #14
Source File: dataset.py From PCWG with MIT License | 5 votes |
def ShowColumnPicker(self, parentDialog, pick, selectedColumn): if self.config.input_time_series.absolute_path == None: tkMessageBox.showwarning( "InputTimeSeriesPath Not Set", "You must set the InputTimeSeriesPath before using the ColumnPicker" ) return inputTimeSeriesPath = self.config.input_time_series.absolute_path headerRows = self.getHeaderRows() if self.columnsFileHeaderRows != headerRows or self.availableColumnsFile != inputTimeSeriesPath: try: self.read_dataset() except ExceptionHandler.ExceptionType as e: tkMessageBox.showwarning( "Column header error", "It was not possible to read column headers using the provided inputs.\rPlease check and amend 'Input Time Series Path' and/or 'Header Rows'.\r" ) ExceptionHandler.add(e, "ERROR reading columns from {0}".format(inputTimeSeriesPath)) self.columnsFileHeaderRows = headerRows self.availableColumnsFile = inputTimeSeriesPath try: base_dialog.ColumnPickerDialog(parentDialog, pick, self.availableColumns, selectedColumn) except ExceptionHandler.ExceptionType as e: ExceptionHandler.add(e, "Error picking column")
Example #15
Source File: tkconch.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def clientConnectionFailed(self, connector, reason): tkMessageBox.showwarning('TkConch','Connection Failed, Reason:\n %s: %s' % (reason.type, reason.value))
Example #16
Source File: mytkSimpleDialog.py From darkc0de-old-stuff with GNU General Public License v3.0 | 5 votes |
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
Example #17
Source File: controlpanel.py From darkc0de-old-stuff with GNU General Public License v3.0 | 5 votes |
def callback(self): tkMessageBox.showwarning(title="Not Implemented", message="This feature has not yet been implemented")
Example #18
Source File: tkSimpleDialog.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
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
Example #19
Source File: tkconch.py From python-for-android with Apache License 2.0 | 5 votes |
def clientConnectionFailed(self, connector, reason): tkMessageBox.showwarning('TkConch','Connection Failed, Reason:\n %s: %s' % (reason.type, reason.value))
Example #20
Source File: spgl.py From SPGL with GNU General Public License v3.0 | 5 votes |
def show_warning(self, title, message): return messagebox.showwarning(title, message)
Example #21
Source File: spgl.py From SPGL with GNU General Public License v3.0 | 5 votes |
def show_warning(self, title, message): return messagebox.showwarning(title, message)
Example #22
Source File: dialog_elements.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #23
Source File: tkSimpleDialog.py From BinderFilter with MIT License | 5 votes |
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
Example #24
Source File: tkSimpleDialog.py From oss-ftp with MIT License | 5 votes |
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
Example #25
Source File: tkconch.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def clientConnectionFailed(self, connector, reason): tkMessageBox.showwarning('TkConch','Connection Failed, Reason:\n %s: %s' % (reason.type, reason.value))
Example #26
Source File: tkconch.py From learn_python3_spider with MIT License | 5 votes |
def clientConnectionFailed(self, connector, reason): tkMessageBox.showwarning('TkConch','Connection Failed, Reason:\n %s: %s' % (reason.type, reason.value))
Example #27
Source File: gui.py From snn_toolbox with MIT License | 5 votes |
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
Example #28
Source File: gui.py From snn_toolbox with MIT License | 5 votes |
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
Example #29
Source File: gui.py From snn_toolbox with MIT License | 5 votes |
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
Example #30
Source File: dialog_elements.py From Enrich2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
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