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 vote down vote up
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 vote down vote up
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: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
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 #4
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
def update_weather_data(self):

        try:
            weather_data = n.get_local_weather(
                self.settings['weather_station'].get()
            )
        except Exception as e:
            messagebox.showerror(
                title='Error',
                message='Problem retrieving weather data',
                detail=str(e)
            )
            self.status.set('Problem retrieving weather data')
        else:
            self.data_model.add_weather_data(weather_data)
            self.status.set(
                'Weather data recorded for {}'
                .format(weather_data['observation_time_rfc822'])
            ) 
Example #5
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
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 #6
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
def check_queue(self, queue):
        if not queue.empty():
            item = queue.get()
            if item.status == 'done':
                messagebox.showinfo(
                    item.status,
                    message=item.subject,
                    detail=item.body
                )
                self.status.set(item.subject)
                return
            elif item.status == 'error':
                messagebox.showerror(
                    item.status,
                    message=item.subject,
                    detail=item.body
                )
                self.status.set(item.subject)
                return
            else:
                self.status.set(item.body)
        self.after(100, self.check_queue, queue) 
Example #7
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
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 #8
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
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 #9
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
def open_record(self, rowkey=None):
        """Rowkey must be a tuple of (Date, Time, Lab, Plot)"""
        if rowkey is None:
            record = None
        else:
            try:
                record = self.data_model.get_record(*rowkey)
            except Exception as e:
                messagebox.showerror(
                    title='Error',
                    message='Problem reading file',
                    detail=str(e)
                )
                return
        self.recordform.load_record(rowkey, record)
        self.recordform.tkraise() 
Example #10
Source File: __init__.py    From lackey with MIT License 5 votes vote down vote up
def popError(text, title="Lackey Error"):
    """ Creates an error dialog with the specified text. """
    root = tk.Tk()
    root.withdraw()
    tkMessageBox.showerror(title, text) 
Example #11
Source File: RegionMatching.py    From lackey with MIT License 5 votes vote down vote up
def _findFailedPrompt(self, pattern):
        ret_value = tkmb.showerror(
            title="Sikuli Prompt", 
            message="Could not find target '{}'. Abort, retry, or skip?".format(pattern), 
            type=tkmb.ABORTRETRYIGNORE)
        value_map = {
            "abort": "ABORT",
            "retry": "RETRY",
            "ignore": "SKIP"
        }
        return value_map[ret_value] 
Example #12
Source File: user_interface.py    From PcapXray with GNU General Public License v2.0 5 votes vote down vote up
def browse_directory(self, option):
        if option == "pcap":
            # Reference: http://effbot.org/tkinterbook/tkinter-dialog-windows.htm
            self.pcap_file.set(fd.askopenfilename(initialdir = sys.path[0],title = "Select Packet Capture File!",filetypes = (("All","*.pcap *.pcapng"),("pcap files","*.pcap"),("pcapng files","*.pcapng"))))
            self.filename = self.pcap_file.get().replace(".pcap","")
            if "/" in self.filename:
                self.filename = self.filename.split("/")[-1]
            #,("all files","*.*")
            #self.filename_field.delete(0, END)
            #self.filename_field.insert(0, self.pcap_file)
            print(self.filename)
            print(self.pcap_file)
        else:
            self.destination_report.set(fd.askdirectory())
            if self.destination_report.get():
                if not os.access(self.destination_report.get(), os.W_OK):
                    mb.showerror("Error","Permission denied to create report! Run with higher privilege.")
            else:
                mb.showerror("Error", "Enter a output directory!") 
Example #13
Source File: asktext.py    From textext with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def cb_ok(self, widget=None, data=None):
        try:
            self.global_scale_factor = float(self._scale.get())
        except ValueError:
            TkMsgBoxes.showerror("Scale factor error",
                                 "Please enter a valid floating point number for the scale factor!")
            return
        self.text = self._text_box.get(1.0, Tk.END)
        self.preamble_file = self._preamble.get()

        try:
            self.callback(self.text, self.preamble_file, self.global_scale_factor, self._alignment_tk_str.get(),
                          self._tex_command_tk_str.get())
        except Exception as error:
            self.show_error_dialog("TexText Error",
                              "Error occurred while converting text from Latex to SVG:",
                              error)
            return False

        self._frame.quit()
        return False 
Example #14
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
def upload_to_corporate_ftp(self):

        csvfile = self._create_csv_extract()

        d = v.LoginDialog(
            self,
            'Login to ABQ Corporate FTP'
        )

        if d.result is not None:
            username, password = d.result
            try:
                n.upload_to_corporate_ftp(
                    csvfile,
                    self.settings['abq_ftp_host'].get(),
                    self.settings['abq_ftp_port'].get(),
                    username,
                    password
                )
            except n.ftp.all_errors as e:
                messagebox.showerror('Error connecting to ftp', str(e))
            else:
                messagebox.showinfo(
                    'Success',
                    '{} successfully uploaded to FTP'.format(csvfile)
                ) 
Example #15
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
def update_weather_data(self):

        try:
            weather_data = n.get_local_weather(
                self.settings['weather_station'].get()
            )
        except Exception as e:
            messagebox.showerror(
                title='Error',
                message='Problem retrieving weather data',
                detail=str(e)
            )
            self.status.set('Problem retrieving weather data')
        else:
            self.data_model.add_weather_data(weather_data)
            self.status.set(
                'Weather data recorded for {}'
                .format(weather_data['observation_time_rfc822'])
            ) 
Example #16
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
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 #17
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
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() 
Example #18
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
def upload_to_corporate_ftp(self):

        csvfile = self._create_csv_extract()

        d = v.LoginDialog(
            self,
            'Login to ABQ Corporate FTP'
        )

        if d.result is not None:
            username, password = d.result
            try:
                n.upload_to_corporate_ftp(
                    csvfile,
                    self.settings['abq_ftp_host'].get(),
                    self.settings['abq_ftp_port'].get(),
                    username,
                    password
                )
            except n.ftp.all_errors as e:
                messagebox.showerror('Error connecting to ftp', str(e))
            else:
                messagebox.showinfo(
                    'Success',
                    '{} successfully uploaded to FTP'.format(csvfile)
                ) 
Example #19
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
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 #20
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
def upload_to_corporate_ftp(self):

        csvfile = self._create_csv_extract()

        d = v.LoginDialog(
            self,
            'Login to ABQ Corporate FTP'
        )

        if d.result is not None:
            username, password = d.result
            try:
                n.upload_to_corporate_ftp(
                    csvfile,
                    self.settings['abq_ftp_host'].get(),
                    self.settings['abq_ftp_port'].get(),
                    username,
                    password
                )
            except n.ftp.all_errors as e:
                messagebox.showerror('Error connecting to ftp', str(e))
            else:
                messagebox.showinfo(
                    'Success',
                    '{} successfully uploaded to FTP'.format(csvfile)
                ) 
Example #21
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
def upload_to_corporate_rest(self):

        csvfile = self._create_csv_extract()

        if csvfile is None:
            messagebox.showwarning(
                title='No records',
                message='There are no records to upload'
            )
            return

        d = v.LoginDialog(
            self,
            'Login to ABQ Corporate REST API'
        )
        if d.result is not None:
            username, password = d.result
        else:
            return
        try:
            n.upload_to_corporate_rest(
                csvfile,
                self.settings['abq_upload_url'].get(),
                self.settings['abq_auth_url'].get(),
                username,
                password)
        except n.requests.RequestException as e:
            messagebox.showerror('Error with your request', str(e))
        except n.requests.ConnectionError as e:
            messagebox.showerror('Error connecting', str(e))
        except Exception as e:
            messagebox.showerror('General Exception', str(e))
        else:
            messagebox.showinfo(
                'Success',
                '{} successfully uploaded to REST API.'.format(csvfile)
            ) 
Example #22
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
def update_weather_data(self):

        try:
            weather_data = n.get_local_weather(
                self.settings['weather_station'].get()
            )
        except Exception as e:
            messagebox.showerror(
                title='Error',
                message='Problem retrieving weather data',
                detail=str(e)
            )
            self.status.set('Problem retrieving weather data')
        else:
            self.data_model.add_weather_data(weather_data)
            self.status.set(
                'Weather data recorded for {}'
                .format(weather_data['observation_time_rfc822'])
            ) 
Example #23
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
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 #24
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
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() 
Example #25
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
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 #26
Source File: application.py    From Python-GUI-Programming-with-Tkinter with MIT License 5 votes vote down vote up
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 #27
Source File: easyModbusGUI.py    From EasyModbusTCP.PY with MIT License 5 votes vote down vote up
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: easyModbusGUI.py    From EasyModbusTCP.PY with MIT License 5 votes vote down vote up
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 #29
Source File: easyModbusGUI.py    From EasyModbusTCP.PY with MIT License 5 votes vote down vote up
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 #30
Source File: easyModbusGUI.py    From EasyModbusTCP.PY with MIT License 5 votes vote down vote up
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()