本文整理汇总了Python中tkinter.messagebox.showerror方法的典型用法代码示例。如果您正苦于以下问题:Python messagebox.showerror方法的具体用法?Python messagebox.showerror怎么用?Python messagebox.showerror使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.messagebox
的用法示例。
在下文中一共展示了messagebox.showerror方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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()
示例2: center_on_node
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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)
示例3: goto_path
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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)
示例4: check_python_version
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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)
示例5: _save_quit
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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
# ==============================================================================
示例6: previewbarcode
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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!")
示例7: read_file
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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 ##
##########################################################################
示例8: read_file
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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 ##
############################################################################
示例9: __ReadCoils
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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()
示例10: __ReadDiscreteInputs
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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()
示例11: __ReadHoldingRegisters
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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()
示例12: open_record
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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()
示例13: update_weather_data
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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'])
)
示例14: check_queue
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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)
示例15: open_record
# 需要导入模块: from tkinter import messagebox [as 别名]
# 或者: from tkinter.messagebox import showerror [as 别名]
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()