Python tkinter.messagebox.showerror() Examples
The following are 30
code examples of tkinter.messagebox.showerror().
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
tkinter.messagebox
, or try the search function
.

Example #1
Source File: viewer.py From networkx_viewer with GNU General Public License v3.0 | 6 votes |
def goto_path(self, event): frm = self.node_entry.get() to = self.node_entry2.get() self.node_entry.delete(0, tk.END) self.node_entry2.delete(0, tk.END) if frm == '': tkm.showerror("No From Node", "Please enter a node in both " "boxes to plot a path. Enter a node in only the first box " "to bring up nodes immediately adjacent.") return if frm.isdigit() and int(frm) in self.canvas.dataG.nodes(): frm = int(frm) if to.isdigit() and int(to) in self.canvas.dataG.nodes(): to = int(to) self.canvas.plot_path(frm, to, levels=self.level)
Example #2
Source File: logreader.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def __init__(self, logPath, mainWindow): super().__init__(logPath, mainWindow) self.log = open(logPath, 'r', encoding="utf8") self.log.readline() self.log.readline() characterLine = self.log.readline() self.character, self.language = ProcessCharacterLine(characterLine) logging.info('Log language is ' + self.language) self.log.readline() self.log.readline() self.logLine = self.log.readline() if (self.logLine == "------------------------------------------------------------\n"): self.log.readline() collisionCharacter, language = ProcessCharacterLine(self.log.readline()) logging.error('Log file collision on characters' + self.character + " and " + collisionCharacter) messagebox.showerror("Error", "Log file collision on characters:\n\n" + self.character + " and " + collisionCharacter + "\n\nThis happens when both characters log in at exactly the same second.\n" + "This makes it impossible to know which character owns which log.\n\n" + "Please restart the client of the character you want to track to use this program.\n" + "If you already did, you can ignore this message, or delete this log file:\n" + logPath) raise BadLogException("log file collision") self.log.read() self.compileRegex()
Example #3
Source File: graph_canvas.py From networkx_viewer with GNU General Public License v3.0 | 5 votes |
def center_on_node(self, data_node): """Center canvas on given **DATA** node""" try: disp_node = self._find_disp_node(data_node) except ValueError as e: tkm.showerror("Unable to find node", str(e)) return x,y = self.coords(self.dispG.node[disp_node]['token_id']) # Find center of canvas w = self.winfo_width()/2 h = self.winfo_height()/2 if w == 0: # We haven't been drawn yet w = int(self['width'])/2 h = int(self['height'])/2 # Calc delta to move to center delta_x = w - x delta_y = h - y self.move(tk.ALL, delta_x, delta_y)
Example #4
Source File: viewer.py From networkx_viewer with GNU General Public License v3.0 | 5 votes |
def add_node(self, event=None): node = self.node_entry.get() if node.isdigit() and self.canvas.dataG.has_node(int(node)): node = int(node) if self.canvas.dataG.has_node(node): self.node_list.insert(tk.END, node) self.node_entry.delete(0, tk.END) else: tkm.showerror("Node not found", "Node '%s' not in graph."%node)
Example #5
Source File: viewer.py From networkx_viewer with GNU General Public License v3.0 | 5 votes |
def level(self): try: l = int(self.level_entry.get()) except ValueError: tkm.showerror("Invalid Level", "Please specify a level between " "greater than or equal to 0") raise return l
Example #6
Source File: sb3tosb2.py From sb3tosb2 with Mozilla Public License 2.0 | 5 votes |
def printError(message, gui): if gui: messagebox.showerror('Error', message, icon='warning') else: lines = message.split('\n') lines = [" " + line for line in lines] lines[0] = "ERROR: " + lines[0][7:] print('\n'.join(lines)) input('Press enter to exit... ') exit()
Example #7
Source File: checkpyver.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
def check_python_version(): """Check if correct python version is run.""" if sys.hexversion < 0x03050200: # We don't use .format() and print_function here just in case someone # still has < 2.6 installed. version_str = '.'.join(map(str, sys.version_info[:3])) text = ("At least Python 3.5.2 is required to run qutebrowser, but " + "it's running with " + version_str + ".\n") if (Tk and # type: ignore[unreachable] '--no-err-windows' not in sys.argv): # pragma: no cover root = Tk() root.withdraw() messagebox.showerror("qutebrowser: Fatal error!", text) else: sys.stderr.write(text) sys.stderr.flush() sys.exit(1)
Example #8
Source File: pynpuzzle.py From pynpuzzle with MIT License | 5 votes |
def save_file_cmd(puzzle_frame, parent): """ Input's save to file button click handler puzzle_frame : The puzzle frame which it's puzzle will be saved to file parent : The parent window of the puzzle_frame This is used for showing the 'save as file' dialog so it can be showed on top of the window. """ # Check if puzzle frame has a valid input, and if not, ask the user if he's sure he wants to save the puzzle lst = is_input_puzzle_valid(puzzle_frame) if not lst: if not messagebox.askokcancel("Input not valid", "Input puzzle is not valid, are you sure to save it as a file?", parent=parent): return # Open the 'save as file' dialog file_name = filedialog.asksaveasfilename(title="Choose a file to save puzzle", parent=parent) # Check if user has selected a file if not file_name: return # Generate file's content len_sqrt = int(math.sqrt(len(lst))) file_lines = [] for i in range(0, len(lst), 3): line_nums = [] for j in range(0, len_sqrt): line_nums.append(str(lst[i + j])) file_lines.append(' '.join(line_nums)) try: with open(file_name, 'w') as file: file.write('\n'.join(file_lines)) except: messagebox.showerror("Error saving to file", "Some problem happened while saving puzzle to the file.", parent=parent) # Save to file button widgget
Example #9
Source File: RAASNet.py From RAASNet with GNU General Public License v3.0 | 5 votes |
def compile_decrypt(self): try: decrypt = open(self.options['decryptor_path'].get()).read() except FileNotFoundError: return messagebox.showerror('ERROR', 'File does not exist, check decryptor path!') try: if self.options['os'].get() == 'windows': py = 'pyinstaller.exe' else: py = 'pyinstaller' if not 'from tkinter.ttk import' in decrypt: tk = '' else: tk = '--hidden-import tkinter --hiddenimport tkinter.ttk --hidden-import io' if not 'from Crypto import Random' in decrypt: crypto = '' else: crypto = '--hidden-import pycryptodome' if not 'import pyaes' in decrypt: pyaes = '' else: pyaes = '--hidden-import pyaes' if not 'from pymsgbox': pymsg = '' else: pymsg = '--hidden-import pymsgbox' os.system('%s -F -w %s %s %s %s %s' % (py, tk, crypto, pyaes, pymsg, self.options['decryptor_path'].get())) messagebox.showinfo('SUCCESS', 'Compiled successfully!\nFile located in: dist/\n\nHappy Hacking!') self.comp.destroy() except Exception as e: messagebox.showwarning('ERROR', 'Failed to compile!\n\n%s' % e)
Example #10
Source File: RAASNet.py From RAASNet with GNU General Public License v3.0 | 5 votes |
def check_activation(self, key): messagebox.showerror('Failed to upgrade', 'Invalid key') self.pro.destroy()
Example #11
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def get_rates(self): try: self.rates = Rates.get() self.populate_comboboxes() except urllib.error.URLError as err: messagebox.showerror("Currency \u2014 Error", str(err), parent=self) self.quit()
Example #12
Source File: workflowcreator.py From CEASIOMpy with Apache License 2.0 | 5 votes |
def _save_quit(self): self.Options.optim_method = self.TabOptim.optim_choice_CB.get() self.Options.module_pre = [item[0] for item in self.TabPre.LB_selected.get(0, tk.END)] self.Options.module_optim = [item[0] for item in self.TabOptim.LB_selected.get(0, tk.END)] self.Options.module_post = [item[0] for item in self.TabPost.LB_selected.get(0, tk.END)] self.Options.cpacs_path = self.path_var.get() if self.path_var.get() == '': messagebox.showerror('ValueError', 'Yon must select an input CPACS file!') raise TypeError('No CPACS file has been define !') self.quit() # ============================================================================== # MAIN # ==============================================================================
Example #13
Source File: barcode-generator-macos.py From Barcode-generator with GNU General Public License v3.0 | 5 votes |
def previewbarcode(self, bcodevalue): tmpbarcode = self.generatebarcode(bcodevalue) validbc = tmpbarcode.validate_draw_barcode() if(validbc): image1 = ImageTk.PhotoImage(validbc) self.imagepanel.create_image( validbc.size[0] / 2, validbc.size[1] / 2, image=image1) self.imagepanel.config( scrollregion=( 0, 0, validbc.size[0], validbc.size[1])) self.imagepanel.image = image1 self.already_exist(False, bcodevalue) else: mbox.showerror("Error", "Barcode couldn't be generated!")
Example #14
Source File: barcode-generator-macos.py From Barcode-generator with GNU General Public License v3.0 | 5 votes |
def savebarcode(self, bcodevalue, autoname=False): savestate = False fname = "" if autoname: fname = self.filedir + '/' + bcodevalue + '.' + self.filetype.lower() else: fname = fdial.asksaveasfilename( defaultextension='png', parent=self.master, title='Saving barcode', filetypes=[ ('PNG', '*.png'), ('JPEG', '*.jpg *.jpeg'), ('GIF', '*.gif'), ('Adobe PDF', '*.pdf'), ('Barcha fayllar', '*.*')]) if(fname): tmpbarcode = self.generatebarcode(bcodevalue) tmpbarcode.filename = fname savestate = tmpbarcode.validate_create_barcode() if(not savestate): mbox.showerror("Warning", "Barcode saving error") else: mbox.showinfo("Info", "Barcode is saved as file successfully")
Example #15
Source File: barcode-generator-macos.py From Barcode-generator with GNU General Public License v3.0 | 5 votes |
def get_from_ini(self): self.config = ConfigParser() if not os.path.isfile('config.ini'): self.check_inifile() self.config.read('config.ini') sect = 'DefaultValues' try: if self.config.get(sect, 'Type'): self.bctype.set(self.config.get(sect, 'Type')) if self.config.get(sect, 'Size'): self.bcsize.set(self.config.get(sect, 'Size')) if self.config.get(sect, 'EAN13start'): self.ean13start = self.config.get(sect, 'EAN13start') if self.config.get(sect, 'EAN08start'): self.ean08start = self.config.get(sect, 'EAN08start') if self.config.get(sect, 'EAN05start'): self.ean05start = self.config.get(sect, 'EAN05start') if self.config.get(sect, 'filedirectory'): self.filedir = self.config.get(sect, 'filedirectory') if self.config.get(sect, 'FileType'): self.filetype = self.config.get(sect, 'FileType') except BaseException: mbox.showerror( "Warning", "Error occured while loading Config.ini!") # Checks and creates if ini file is not found
Example #16
Source File: barcode-generator-macos.py From Barcode-generator with GNU General Public License v3.0 | 5 votes |
def read_file(self): if os.path.isfile('data.csv'): try: with open('data.csv', encoding="utf-8") as csvfile: reader = csv.DictReader( csvfile, fieldnames=None, delimiter=";") for row in reader: self.tree.insert("", "end", row["id"], text=row["id"], values=[row["barcodes"], row["type"], row["comment"]]) self.zebra() except BaseException: mbox.showerror( "Error", "Error occured while loading Data.csv!") ########################################################################## ## BARCODE VALIDATIONS ## ##########################################################################
Example #17
Source File: barcode-generator-Windows.py From Barcode-generator with GNU General Public License v3.0 | 5 votes |
def previewbarcode(self, bcodevalue): tmpbarcode = self.generatebarcode(bcodevalue) validbc = tmpbarcode.validate_draw_barcode(); if(validbc): image1 = ImageTk.PhotoImage(validbc); self.imagepanel.create_image(validbc.size[0]/2, validbc.size[1]/2, image=image1); self.imagepanel.config(scrollregion=(0,0, validbc.size[0], validbc.size[1])); self.imagepanel.image = image1; self.already_exist(False, bcodevalue) else: mbox.showerror("Error", "Barcode couldn't be generated!")
Example #18
Source File: barcode-generator-Windows.py From Barcode-generator with GNU General Public License v3.0 | 5 votes |
def get_from_ini(self): self.config = ConfigParser() if not os.path.isfile('config.ini'): self.check_inifile() self.config.read('config.ini') sect = 'DefaultValues' try: if self.config.get(sect, 'Type'): self.bctype.set(self.config.get(sect, 'Type')) if self.config.get(sect, 'Size'): self.bcsize.set(self.config.get(sect, 'Size')) if self.config.get(sect, 'EAN13start'): self.ean13start = self.config.get(sect, 'EAN13start') if self.config.get(sect, 'EAN08start'): self.ean08start = self.config.get(sect, 'EAN08start') if self.config.get(sect, 'EAN05start'): self.ean05start = self.config.get(sect, 'EAN05start') if self.config.get(sect, 'filedirectory'): self.filedir = self.config.get(sect, 'filedirectory') if self.config.get(sect, 'FileType'): self.filetype = self.config.get(sect, 'FileType') except: mbox.showerror("Warning", "Error occured while loading Config.ini!"); # Checks and creates if ini file is not found
Example #19
Source File: barcode-generator-Windows.py From Barcode-generator with GNU General Public License v3.0 | 5 votes |
def read_file(self): if os.path.isfile('data.csv'): try: with open('data.csv', encoding="utf-8") as csvfile: reader = csv.DictReader(csvfile, fieldnames = None, delimiter=";") for row in reader: self.tree.insert("", "end", row["id"], text=row["id"], values=[row["barcodes"], row["type"], row["comment"]]) self.zebra() except: mbox.showerror("Xatolik", "Error occured while loading Data.csv!"); ############################################################################ ## BARCODE VALIDATIONS ## ############################################################################
Example #20
Source File: barcode-generator-Linux.py From Barcode-generator with GNU General Public License v3.0 | 5 votes |
def previewbarcode(self, bcodevalue): tmpbarcode = self.generatebarcode(bcodevalue) validbc = tmpbarcode.validate_draw_barcode(); if(validbc): image1 = ImageTk.PhotoImage(validbc); self.imagepanel.create_image(validbc.size[0]/2, validbc.size[1]/2, image=image1); self.imagepanel.config(scrollregion=(0,0, validbc.size[0], validbc.size[1])); self.imagepanel.image = image1; self.already_exist(False, bcodevalue) else: mbox.showerror("Error", "Barcode couldn't be generated!")
Example #21
Source File: barcode-generator-Linux.py From Barcode-generator with GNU General Public License v3.0 | 5 votes |
def savebarcode(self, bcodevalue, autoname=False): savestate = False; fname = ""; if autoname: fname = self.filedir+'/'+ bcodevalue + '.' + self.filetype.lower() else: fname = fdial.asksaveasfilename(defaultextension='png', parent=self.master, title='Saving barcode', filetypes=[('PNG','*.png'), ('JPEG','*.jpg *.jpeg'), ('GIF','*.gif'), ('Adobe PDF','*.pdf'), ('Barcha fayllar','*.*')]); if(fname): tmpbarcode = self.generatebarcode(bcodevalue) tmpbarcode.filename = fname; savestate = tmpbarcode.validate_create_barcode(); if(not savestate): mbox.showerror("Warning", "Barcode saving error"); else: mbox.showinfo("Info", "Barcode is saved as file successfully");
Example #22
Source File: barcode-generator-Linux.py From Barcode-generator with GNU General Public License v3.0 | 5 votes |
def get_from_ini(self): self.config = ConfigParser() if not os.path.isfile('config.ini'): self.check_inifile() self.config.read('config.ini') sect = 'DefaultValues' try: if self.config.get(sect, 'Type'): self.bctype.set(self.config.get(sect, 'Type')) if self.config.get(sect, 'Size'): self.bcsize.set(self.config.get(sect, 'Size')) if self.config.get(sect, 'EAN13start'): self.ean13start = self.config.get(sect, 'EAN13start') if self.config.get(sect, 'EAN08start'): self.ean08start = self.config.get(sect, 'EAN08start') if self.config.get(sect, 'EAN05start'): self.ean05start = self.config.get(sect, 'EAN05start') if self.config.get(sect, 'filedirectory'): self.filedir = self.config.get(sect, 'filedirectory') if self.config.get(sect, 'FileType'): self.filetype = self.config.get(sect, 'FileType') except: mbox.showerror("Warning", "Error occured while loading Config.ini!"); # Checks and creates if ini file is not found
Example #23
Source File: easyModbusGUI.py From EasyModbusTCP.PY with MIT License | 5 votes |
def __ReadCoils(self): try: modbusClient = ModbusClient(self.ipAddressEntry.get(), int(self.portEntry.get())) if (not modbusClient.is_connected()): modbusClient.connect() coils = modbusClient.read_coils(int(self.startingAddress.get()) - 1, int(self.quantity.get())) self.responseTextField.delete('1.0', END) for coil in coils: if (coil == FALSE): response = "FALSE" else: response = "TRUE" self.responseTextField.insert(END, response + "\n") except Exception as e: messagebox.showerror('Exception Reading coils from Server', str(e)) finally: modbusClient.close()
Example #24
Source File: easyModbusGUI.py From EasyModbusTCP.PY with MIT License | 5 votes |
def __ReadDiscreteInputs(self): try: modbusClient = ModbusClient(self.ipAddressEntry.get(), int(self.portEntry.get())) if (not modbusClient.is_connected()): modbusClient.connect() discrInputs = modbusClient.read_discreteinputs(int(self.startingAddress.get()) - 1, int(self.quantity.get())) self.responseTextField.delete('1.0', END) for inp in discrInputs: if (inp == FALSE): response = "FALSE" else: response = "TRUE" self.responseTextField.insert(END, response + "\n") except Exception as e: messagebox.showerror('Exception Reading discrete inputs from Server', str(e)) finally: modbusClient.close()
Example #25
Source File: easyModbusGUI.py From EasyModbusTCP.PY with MIT License | 5 votes |
def __ReadHoldingRegisters(self): try: modbusClient = ModbusClient(self.ipAddressEntry.get(), int(self.portEntry.get())) if (not modbusClient.is_connected()): modbusClient.connect() holdingRegisters = modbusClient.read_holdingregisters(int(self.startingAddress.get()) - 1, int(self.quantity.get())) self.responseTextField.delete('1.0', END) for register in holdingRegisters: self.responseTextField.insert(END, str(register) + "\n") except Exception as e: messagebox.showerror('Exception Reading holding registers from Server', str(e)) finally: modbusClient.close()
Example #26
Source File: easyModbusGUI.py From EasyModbusTCP.PY with MIT License | 5 votes |
def __ReadInputRegisters(self): try: modbusClient = ModbusClient(self.ipAddressEntry.get(), int(self.portEntry.get())) if (not modbusClient.is_connected()): modbusClient.connect() inputRegisters = modbusClient.read_inputregisters(int(self.startingAddress.get()) - 1, int(self.quantity.get())) self.responseTextField.delete('1.0', END) for register in inputRegisters: self.responseTextField.insert(END, str(register) + "\n") modbusClient.close() except Exception as e: messagebox.showerror('Exception Reading input Registers from Server', str(e))
Example #27
Source File: easyModbusGUI.py From EasyModbusTCP.PY with MIT License | 5 votes |
def __writeValuesToServer(self): try: modbusClient = ModbusClient(self.ipAddressEntry.get(), int(self.portEntry.get())) if (not modbusClient.is_connected()): modbusClient.connect() numberOfLines = (int(self.requestTextField.index('end').split('.')[0]) - 2) if (self.variableDatatype.get() == 'Coils (bool)'): if (numberOfLines > 1): valueToWrite = list() for i in range(1, numberOfLines+1): textFieltValues = str(self.requestTextField.get(str(i)+".0", str(i+1)+".0")[:-1]) if "TRUE" in textFieltValues: #String comparison contains some ""Null" symbol valueToWrite.append(1) else: valueToWrite.append(0) modbusClient.write_multiple_coils(int(self.startingAddressWrite.get()) - 1, valueToWrite) else: textFieltValues = str(self.requestTextField.get('1.0', END)[:-1]) if "TRUE" in textFieltValues: #String comparison contains some ""Null" symbol dataToSend = 1 else: dataToSend = 0 modbusClient.write_single_coil(int(self.startingAddressWrite.get()) - 1, dataToSend) else: if (numberOfLines > 1): valueToWrite = list() for i in range(1, numberOfLines+1): textFieltValues = int(self.requestTextField.get(str(i)+".0", str(i+1)+".0")[:-1]) valueToWrite.append(textFieltValues) modbusClient.write_multiple_registers(int(self.startingAddressWrite.get()) - 1, valueToWrite) else: textFieltValues = int(self.requestTextField.get('1.0', END)[:-1]) modbusClient.write_single_register(int(self.startingAddressWrite.get()) - 1, textFieltValues) except Exception as e: messagebox.showerror('Exception writing values to Server', str(e)) modbusClient.close()
Example #28
Source File: application.py From Python-GUI-Programming-with-Tkinter with MIT License | 5 votes |
def on_save(self): """Handles save button clicks""" # Check for errors first errors = self.recordform.get_errors() if errors: message = "Cannot save record" detail = "The following fields have errors: \n * {}".format( '\n * '.join(errors.keys()) ) self.status.set( "Cannot save, error in fields: {}" .format(', '.join(errors.keys())) ) messagebox.showerror(title='Error', message=message, detail=detail) return False filename = self.filename.get() model = m.CSVModel(filename) data = self.recordform.get() model.save_record(data) self.records_saved += 1 self.status.set( "{} records saved this session".format(self.records_saved) ) self.recordform.reset() # new code for ch6
Example #29
Source File: application.py From Python-GUI-Programming-with-Tkinter with MIT License | 5 votes |
def populate_recordlist(self): try: rows = self.data_model.get_all_records() except Exception as e: messagebox.showerror( title='Error', message='Problem reading file', detail=str(e) ) else: self.recordlist.populate(rows)
Example #30
Source File: application.py From Python-GUI-Programming-with-Tkinter with MIT License | 5 votes |
def open_record(self, rownum=None): if rownum is None: record = None else: rownum = int(rownum) try: record = self.data_model.get_record(rownum) except Exception as e: messagebox.showerror( title='Error', message='Problem reading file', detail=str(e) ) return self.recordform.load_record(rownum, record) self.recordform.tkraise()