本文整理汇总了Python中tkMessageBox.showerror函数的典型用法代码示例。如果您正苦于以下问题:Python showerror函数的具体用法?Python showerror怎么用?Python showerror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了showerror函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: analysis
def analysis(self):
try:
inputFile1 = self.filelocation1.get()
window1 = self.w1_type.get()
M1 = int(self.M1.get())
N1 = int(self.N1.get())
t1 = int(self.t1.get())
minSineDur1 = float(self.minSineDur1.get())
minf01 = int(self.minf01.get())
maxf01 = int(self.maxf01.get())
f0et1 = int(self.f0et1.get())
harmDevSlope1 = float(self.harmDevSlope1.get())
nH = int(self.nH.get())
stocf = float(self.stocf.get())
inputFile2 = self.filelocation2.get()
window2 = self.w2_type.get()
M2 = int(self.M2.get())
N2 = int(self.N2.get())
t2 = int(self.t2.get())
minSineDur2 = float(self.minSineDur2.get())
minf02 = int(self.minf02.get())
maxf02 = int(self.maxf02.get())
f0et2 = int(self.f0et2.get())
harmDevSlope2 = float(self.harmDevSlope2.get())
self.inputFile1, self.fs1, self.hfreq1, self.hmag1, self.stocEnv1, \
self.inputFile2, self.hfreq2, self.hmag2, self.stocEnv2 = hM.analysis(inputFile1, window1, M1, N1, t1, \
minSineDur1, nH, minf01, maxf01, f0et1, harmDevSlope1, stocf, inputFile2, window2, M2, N2, t2, minSineDur2, minf02, maxf02, f0et2, harmDevSlope2)
except ValueError as errorMessage:
tkMessageBox.showerror("Input values error", errorMessage)
示例2: Conv
def Conv(self): # 转换图片
n = 0
if self.mstatus.get():
path = self.entryDir.get()
if path == '':
tkMessageBox.showerror('Python Tkinter','请输入路径')
return
filenames = os.listdir(path)
if self.fstatus.get():
f = self.Image.get()
for filename in filenames:
if filename[-3:] in ('bmp','jpg','gif','png'):
self.make(path + '/' + filename, f)
n = n + 1
else:
for filename in filenames:
if filename[-3:] in ('bmp','jpg','gif','png'):
self.make(path + '/' + filename)
n = n + 1
else:
file = self.entryFile.get()
if file == '':
tkMessageBox.showerror('Python Tkinter','请选择文件')
return
if self.fstatus.get():
f = self.Image.get()
self.make(file, f)
n = n + 1
else:
self.make(file)
n = n + 1
self.status.set('成功转换%d图片' % n)
示例3: _load
def _load():
filename = askopenfilename(initialdir='accpy/exampledata/')
if filename[-5::] != '.hdf5':
filestr.set('error: {} is not hdf5 file-type'.format(filename))
showerror('ERROR', 'THIS IS NOT A HDF5 FILE')
else:
filestr.set(filename)
示例4: login
def login(self, event=None):
"Check the user's input and allow access if it is correct"""
usernameGiven = self.userEntry.get()
passwordGiven = self.passEntry.get()
userDetails = self.db.sql("""SELECT * FROM
users WHERE username='%s'"""
%(usernameGiven.lower().strip()))
#Check that the username exists
if len(userDetails)==1:
passHash = userDetails[0][2]
#Check that the password is correct
if (hashlib.sha1(passwordGiven).hexdigest() == passHash):
#Details are correct, unlock application
self.parent.login(User(userDetails[0]))
loginFailed = False
else:
loginFailed = True
else:
loginFailed = True
if loginFailed:
#If details are incorrect show an error message
tkMessageBox.showerror("Login Failed",
"Invalid username or password")
self.userEntry.delete(0, END)
self.passEntry.delete(0, END)
示例5: SaveGeneratedBarcode
def SaveGeneratedBarcode():
GenerateBarcode();
upc_validate = entry1.get();
if(listboxtxt1.get()=="UPC-A" or listboxtxt1.get()=="UPC-E" or listboxtxt1.get()=="EAN-13" or listboxtxt1.get()=="EAN-8"):
if(re.findall("([0-9]+)([ |\|]{1})([0-9]{2})$", entry1.get())):
upc_pieces = re.findall("([0-9]+)([ |\|]{1})([0-9]{2})$", entry1.get());
upc_pieces = upc_pieces[0];
upc_validate = upc_pieces[0];
if(re.findall("([0-9]+)([ |\|]){1}([0-9]{5})$", entry1.get())):
upc_pieces = re.findall("([0-9]+)([ |\|]){1}([0-9]{5})$", entry1.get());
upc_pieces = upc_pieces[0];
upc_validate = upc_pieces[0];
savestate = False;
savefname = "";
tmpbarcode = upcean.oopfuncs.barcode(barcode_list[listboxtxt1.get()], entry1.get());
tmpbarcode.size = magnify.get();
tmpbarcode.barheight = (int(entry2.get()),int(entry3.get()));
tmpbarcode.barcolor = barcode_bar_color;
tmpbarcode.textcolor = barcode_text_color;
tmpbarcode.bgcolor = barcode_bg_color;
savefname = ShowSaveDialog();
tmpbarcode.filename = savefname;
if(savefname!=""):
savestate = tmpbarcode.validate_create_barcode();
if(not savestate and savefname!=""):
tkMessageBox.showerror("PyUPC-EAN - Error", "Failed to save barcode.");
示例6: openXML
def openXML(mainApp, filename=''):
if askSaveChanges(mainApp):
label_filename = mainApp.frames.menu.dic['label_filename']
if filename=='':
filename = getFilename()
if filename <> '':
mainApp.frames.treeview.clean()
mainApp.frames.buttons.clean()
GL.filename = filename
label_filename.config(text= GL.filename)
root = xml_man.getXML(GL.filename)
#root = xml_man.getXML('stylers.xml')
if root == None:
tkMessageBox.showerror('eXMLorer', 'El archivo %s no es un archivo XML valido' % GL.filename)
label_filename.config(text= '')
else:
GL.dicTagsInTree = {}
GL.appTreeView = tk_treeview.getTreeView(mainApp.frames.treeview, mainApp.frames.buttons, GL.dicTagsInTree)
GL.dicTagsInTree[root.tag] = TIG.TagInTree('', root.tag, root, None, GL.appTreeView)
mainApp.rootTIG = GL.dicTagsInTree[root.tag]
addXMLToTree(root, root.tag, GL.dicTagsInTree, GL.appTreeView)
示例7: make_authorization
def make_authorization(self):
cashier_id, warehouse_id = workplace_authorization.get_workpace_data()
#print cashier_id, warehouse_id
success = True
error_message = ""
if None == cashier_id or None == warehouse_id or \
"" == cashier_id or "" == warehouse_id:
error_message = "Все указанные поля должны быть заполнены"
success = False
if success:
try:
res = cashier_workplace.authorization(cashier_id, warehouse_id)
except Exception:
res = False
error_message = "Неверно заполнены поля авторизации"
success = success and res
if not res:
error_message = "Вы не обладаете полномочиями для авторизации. " \
"Проверьте вводимые значение. А возможно, вы уже уволены"
if success:
self.auth_cashier_btn['command'] = self.make_logout
self.auth_cashier_btn['text'] = "Деавторизация"
self.compute_bonus_btn['state'] = 'normal'
self.dismiss_cashier_btn['state'] = 'normal'
self.get_goods_table_btn['state'] = 'normal'
self.update_goods_info_btn['state'] = 'normal'
self.change_cash_status_btn['state'] = 'normal'
else:
tkMessageBox.showerror("Ошибка авторизации", error_message)
self.mainloop()
示例8: strip
def strip(root, amber_prmtop, messages):
""" Strips a mask from the topology file """
if amber_prmtop.parm.chamber:
showerror('Not Implemented', 'The strip command does not yet work with ' +
'chamber topologies')
return
# We need a mask, new radius, new epsilon, and for chamber topologies,
# a new radius-1-4 and epsilon-1-4. Don't add the latter ones until we
# know if we have a chamber prmtop or not.
widget_list = [('MaskEntry', 'Atoms to strip from topology')]
# We need 5 string variables, then get the description.
var_list = [StringVar()]
description=('Strips the selected atoms from the topology file. All\n' +
'remaining atoms and parameters remain unchanged. Any\n' +
'parameters associated with stripped atoms are removed.')
# Create the window, open it, then wait for it to close
cmd_window = _guiwidgets.ActionWindow('addLJType', amber_prmtop,
widget_list, var_list, description)
cmd_window.wait_window()
# See if we got any variables back
var = var_list[0]
if not var.get(): return
try:
action = ParmedActions.strip(amber_prmtop, ArgumentList(var.get()))
except Exception, err:
showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
return
示例9: addexclusions
def addexclusions(root, amber_prmtop, messages):
""" Adds atoms to other atoms' exclusion list """
# We need 2 masks
widget_list = [('MaskEntry', 'Atoms to add excluded atoms to'),
('MaskEntry', 'Atoms to exclude from other mask')]
# We have 2 mask variables
var_list = [StringVar(), StringVar()]
# Description
description=('Allows you to add arbitrary excluded atoms to exclusion\n' +
'lists. This omits all non-bonded interactions in the direct-space\n' +
'calculation, but does not omit interactions from adjacent cells in\n' +
'periodic simulations')
cmd_window = _guiwidgets.ActionWindow('addExclusions', amber_prmtop,
widget_list, var_list, description)
cmd_window.wait_window()
# Bail out if we didn't get any variables
if not True in [bool(v.get()) for v in var_list]: return
var_list = [v.get() for v in var_list]
try:
action = ParmedActions.addexclusions(amber_prmtop, ArgumentList(var_list))
except Exception, err:
showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
return
示例10: change
def change(root, amber_prmtop, messages):
""" Allows us to change a specific atomic property """
# The spinbox is sent with the Spinbox, label, and then a list of all of the
# values to give to it
widget_list = [('Spinbox', 'Property to change', 'CHARGE', 'MASS',
'RADII', 'SCREEN', 'ATOM_NAME', 'AMBER_ATOM_TYPE',
'ATOM_TYPE_INDEX', 'ATOMIC_NUMBER'),
('MaskEntry', 'Atoms to change'),
('Entry', 'New Value for Property')]
# We need 3 string variables, then get the description
var_list = [StringVar(), StringVar(), StringVar()]
description = 'Changes the property of given atoms to a new value'
# Create the window, open it, then wait for it to close
cmd_window = _guiwidgets.ActionWindow('change', amber_prmtop,
widget_list, var_list, description)
cmd_window.wait_window()
# See if we got any variables back
vars_found = True in [bool(v.get()) for v in var_list]
if not vars_found: return
# If we did, store them and pass it to the class
var_list = [v.get() for v in var_list]
try:
action = ParmedActions.change(amber_prmtop, ArgumentList(var_list))
except Exception, err:
showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
return
示例11: printinfo
def printinfo(root, amber_prmtop, messages):
""" Prints all of the info in a given FLAG """
# Set up the window
# variables we need for printInfo
widget_list = [('Entry', '%FLAG you want info from')]
# Variable list -- we need a single string
var_list = [StringVar()]
# description
description = ' '.join(ParmedActions.printinfo.__doc__.split())
cmd_window = _guiwidgets.ActionWindow('printInfo', amber_prmtop,
widget_list, var_list, description)
cmd_window.wait_window()
# Make sure we didn't cancel (or just press OK with no input), or just leave
var = var_list[0].get()
if not var: return
# Now that we did something, do it
action = ParmedActions.printinfo(amber_prmtop, ArgumentList(var))
if not action.found:
showerror('Not Found!', '%%FLAG %s not found!' % var.upper())
return
window = Toplevel(root)
window.resizable(True, True)
window.title('%%FLAG %s Info in %s' % (var.upper(), amber_prmtop))
text = _guiwidgets.ExitingScrollText(window, None, spacing3=5, padx=5,
pady=5, width=82, height=20)
text.write(action)
text.pack(fill=BOTH, expand=1)
window.wait_window()
messages.write('Wrote info for flag %s\n' % var.upper())
示例12: changelj14pair
def changelj14pair(root, amber_prmtop, messages):
""" Changes specific 1-4 Lennard Jones pairs """
# Only good for chamber topologies
if not amber_prmtop.parm.chamber:
showerror('Incompatible',
'changeLJ14Pair is only valid for chamber topologies!')
return
# variables we need for changelj14pair
widget_list = [('MaskEntry', 'Atom(s) Type 1 Mask'),
('MaskEntry', 'Atom(s) Type 2 Mask'),
('Entry', 'Combined Radius'),
('Entry', 'Combined Well Depth')]
# Variable list -- we need 2 masks and 2 floats
var_list = [StringVar(), StringVar(), StringVar(), StringVar()]
# description
description = ' '.join(ParmedActions.changeljpair.__doc__.split())
cmd_window = _guiwidgets.ActionWindow('changeLJ14Pair', amber_prmtop,
widget_list, var_list, description)
cmd_window.wait_window()
# Make sure we didn't cancel (or just press OK with no input), or just leave
vars_exist = True in [bool(v.get()) for v in var_list]
if not vars_exist: return
# Now that we did something, do it
var_list = [v.get() for v in var_list]
try:
action=ParmedActions.changelj14pair(amber_prmtop, ArgumentList(var_list))
messages.write('%s\n' % action)
action.execute()
except Exception, err:
showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
示例13: plot_graph
def plot_graph(self):
self.pattern=re.compile(".*\.(xlsx|ods)")
self.match = self.pattern.match(self.filename)
if not self.match or self.filename is None:
tkMessageBox.showerror(title="Wrong Input",message="Invalid File Type")
exit()
self.wb=xlrd.open_workbook(self.filename)
s=self.wb.sheet_by_index(0)
top = Toplevel()
self.varx=IntVar()
self.vary=IntVar()
top.title("Configuration")
w=Label(top,text=str(s.ncols)+" columns found")
w.pack()
x=Label(top,text="Assign column to the x-axis")
x.pack()
for i in range(s.ncols):
c=Radiobutton(top, text="Column "+str(i+1),variable=self.varx, value=i)
c.pack(anchor=W)
y=Label(top,text="Assign column to the y-axis")
y.pack()
for i in range(s.ncols):
d=Radiobutton(top,text="Column "+str(i+1),variable=self.vary,value=i)
d.pack(anchor=W)
self.plott=Button(top,text="Plot Graph",command=self.sweg).pack()
示例14: add_customer
def add_customer(self, event=None):
# validate and show errors
if self.fname.get() == '':
showerror("Error!", "First name field blank!")
elif self.lname.get() == '':
showerror("Error!", "Last name field blank!")
elif self.mname.get() == '':
showerror("Error!", "Middle initial field blank!")
elif self.payment.get() not in ("Drop In", "Punch Card", "Monthly", "Inactive"):
showerror("Error!", "Incorect Customer type!")
elif not re.compile(r'[01]?\d/[0123]?\d/[12]\d{1,3}').search(self.date.get()):
showerror("Error!", "Bad entry for date, use format mm/dd/yyyy")
else:
# do work
name = ' '.join([self.fname.get(),self.mname.get(),self.lname.get()])
old, row = self.customers.find(str(self.lname.get()).strip(), str(self.fname.get()).strip(),
str(self.mname.get()).strip())
new = [str(self.lname.get()).strip(), str(self.fname.get()).strip(), str(self.mname.get()).strip(),
str(self.payment.get()).strip(), datetime.strptime(self.date.get(), "%m/%d/%Y")]
if not old: #add customer
self.customers.add(new)
self.output_text("+ - New Customer: " + name + " (" + self.payment.get() + ")\n")
self.refresh()
else:
var = IntVar()
diag = AlreadyExistsDialog(self.root, new, old, var)
diag.show()
if var.get() == 0: # edit
pass
if var.get() == 1: # replace customer
self.customers.replace(row, new)
self.output_text("+ - Modified: " + name + " (" + self.payment.get() + ")\n")
self.refresh()
示例15: __plist2Excel__
def __plist2Excel__(self):
if self.outEntry.get() == "" or self.plistEntry.get() == "":
tkMessageBox.showerror('Result',"input res or plist res is requested!")
return
info = self.scanPlist.scanPlistDir(self.outEntry.get(),self.plistEntry.get())
tkMessageBox.showinfo('Result',info)