本文整理汇总了Python中tkMessageBox.showwarning函数的典型用法代码示例。如果您正苦于以下问题:Python showwarning函数的具体用法?Python showwarning怎么用?Python showwarning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了showwarning函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checksheet_name
def checksheet_name(name):
if name == '':
tkMessageBox.showwarning("Whoops", "Name should not be blank.")
return 0
if self.sheets.has_key(name):
tkMessageBox.showwarning("Name exists", "Sheet name already exists!")
return 0
示例2: __init__
def __init__(self, host = HOST, port = PORT, start_server = True):
self.addr = (host, port)
self.connected = False
self.failed = False
self.server_process = None
if start_server:
missing = set([])
try:
import wx
except ImportError:
missing.add('wx')
try:
import matplotlib
except ImportError:
missing.add('matplotlib')
try:
import numpy
except ImportError:
missing.add('numpy')
if not len(missing):
try:
self.server_process = Popen(['python','plot_server.py'])
print 'plot server started!'
except:
print 'Could not start plot server!'
else:
import tkMessageBox
tkMessageBox.showwarning('Warning!', 'Could not start plot window because the following module(s) are missing: ' + ', '.join(missing))
示例3: start
def start(self):
if self.state == self.gs_running:
self.start_button["text"] = "Run"
self.run_tracking_semaphore.clear();
self.state = self.gs_paused
elif self.state == self.gs_paused:
self.start_button["text"] = "Pause"
self.run_tracking_semaphore.set();
self.next_frame_semaphore.set();
self.state = self.gs_running
self.root.after(1, self.poll_tracking_flow)
else:
bg = cv2.imread(self.get_bg_file_name())
if bg is None:
tkMessageBox.showwarning('Start tracking', 'Can''t find the backgound image file')
return;
self.start_button["text"] = "Pause"
self.run_tracking_semaphore.set();
self.tracking_thread = threading.Thread(target = self.tracking.do_tracking, args =
(bg, self.current_frame_number, self.tracking_flow, self.time_to_stop, self.next_frame_semaphore, self.run_tracking_semaphore))
# self.tracking.do_tracking(self.video_file_name, self.current_frame_number, self.tracking_flow, self.time_to_stop);
analyzer_state = self.analyzer_states[self.analyzer_index.get()]
if not (analyzer_state is None):
self.analyzer = analyzer_state.factory.create_analyzer(analyzer_state.configuration, TextBoxLogger(self.analyzer_messages))
else:
self.analyzer = None
self.tracking_thread.start()
self.poll_tracking_flow()
self.state = self.gs_running
示例4: _CreateWidgetsAgentsNeutral
def _CreateWidgetsAgentsNeutral(self):
"""
This intialises and displays the neutral agent's widgets
Arguments:
Specifics:
"""
try:
self.NeutralOptimism = StringVar()
self.NeutralOptimism.set("10")
self.txtNeutralOptimism = Entry(self, textvariable=self.NeutralOptimism)
self.txtNeutralOptimism.grid(row=8, column=1)
self.NeutralPessimism = StringVar()
self.NeutralPessimism.set("10")
self.txtNeutralPessimism = Entry(self, textvariable=self.NeutralPessimism)
self.txtNeutralPessimism.grid(row=8, column=2)
self.NumberOfNeutral = StringVar()
self.NumberOfNeutral.set("0")
self.txtNumberOfNeutral = Entry(self, textvariable=self.NumberOfNeutral)
self.txtNumberOfNeutral.grid(row=8, column=3)
#// Custom Class Error's first
except:
raise ReynoldsWindowCreateWidgetsError("_CreateWidgetsAgentsNeutral Failed")
messagebox.showwarning("Internal Method Error", "_CreateWidgetsAgentsNeutral Failed")
示例5: send
def send(self):
import httplib, urllib
global errors
email = self.email.get()
desc = self.text.get('1.0', END).strip()
# Send information
self.config(cursor="watch")
self.text.config(cursor="watch")
self.update_idletasks()
params = urllib.urlencode({"email":email, "desc":desc})
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
conn = httplib.HTTPConnection("www.fluka.org:80")
try:
conn.request("POST", "/flair/send_email_bcnc.php", params, headers)
response = conn.getresponse()
except:
tkMessageBox.showwarning(_("Error sending report"),
_("There was a problem connecting to the web site"),
parent=self)
else:
if response.status == 200:
tkMessageBox.showinfo(_("Report successfully send"),
_("Report was successfully uploaded to web site"),
parent=self)
del errors[:]
else:
tkMessageBox.showwarning(_("Error sending report"),
_("There was an error sending the report\nCode=%d %s")%\
(response.status, response.reason),
parent=self)
conn.close()
self.config(cursor="")
self.cancel()
示例6: new_plink
def new_plink(self):
'''Draw new link in PLink'''
print '\nNew PLink'
try:
data = load_plink(gui=True)
except Exception as error:
tkMessageBox.showwarning('PLink error', \
'Perhaps PLink is not installed properly?')
print traceback.print_exc()
return
object_data = make_objects(data[0],data[1],data[2],data[3],data[4],
data[5])
regions = object_data[3]
if data[6] == '':
path = 'PLink data not saved'
print path
else:
path = data[6]
print 'Saved to %s' %path
if self.show_shaded.get():
vie = (object_data[0], object_data[1], object_data[2])
# Vertices, Intersections, Edges
else:
vie = None
self.p_output(regions, vie, path)
示例7: _CreateWidgetsAgentsPessimistic
def _CreateWidgetsAgentsPessimistic(self):
"""
This intialises and displays the pessimistic agent's widgets
Arguments:
Specifics:
"""
try:
self.PessimisticOptimism = StringVar()
self.PessimisticOptimism.set("20")
self.txtPessimisticOptimism = Entry(self, textvariable=self.PessimisticOptimism)
self.txtPessimisticOptimism.grid(row=5, column=1)
self.PessimisticPessimism = StringVar()
self.PessimisticPessimism.set("50")
self.txtPessimisticPessimism = Entry(self, textvariable=self.PessimisticPessimism)
self.txtPessimisticPessimism.grid(row=5, column=2)
self.NumberOfPessimists = StringVar()
self.NumberOfPessimists.set("0")
self.txtNumberOfPessimists = Entry(self, textvariable=self.NumberOfPessimists)
self.txtNumberOfPessimists.grid(row=5, column=3)
#// Custom Class Error's first
except:
raise ReynoldsWindowCreateWidgetsError("_CreateWidgetsAgentsPessimistic Failed")
messagebox.showwarning("Internal Method Error", "_CreateWidgetsAgentsPessimistic Failed")
示例8: loadDG7
def loadDG7(self, fields, data):
if data.has_key('5F43'):
try:
stream = convertImage(data['5F43'][0])
self.updatePicture(stream, self.SIGN)
except Exception, msg:
tkMessageBox.showwarning("Image Error", str(msg))
示例9: apply
def apply(self):
self.result.append( self.e1.get(tk.ACTIVE) )
self.result.append( self.e2.get(tk.ACTIVE) )
if not self.e1.curselection():
self.result[0] = None
print "e1 active is ", self.result[0]
if not self.e2.curselection():
self.result[1] = None
print "e2 active is ", self.result[1]
length = 0
for i in range(len(self.result)):
if self.result[i] != None:
length+=1
if(length == 2):
return self.result
else:
tkMessageBox.showwarning("Instructions", "You must select an independent and a dependent variable")
return None
示例10: add_show
def add_show(self,default):
# append it to the showlist and then add the medialist
if self.current_showlist<>None:
d = Edit1Dialog(self.root,"AddShow",
"Show Reference", "")
if d.result == None:
return
name=str(d.result)
if name=="":
tkMessageBox.showwarning(
"Add Show",
"Name is blank"
)
return
if self.current_showlist.index_of_show(name)<>-1:
tkMessageBox.showwarning(
"Add Show",
"A Show with this name already exists"
)
return
copied_show=self.current_showlist.copy(default,name)
mediafile=self.add_medialist(name)
if mediafile<>'':
copied_show['medialist']=mediafile
self.current_showlist.append(copied_show)
self.save_showlist(self.pp_profile_dir)
self.refresh_shows_display()
示例11: add_medialist
def add_medialist(self,name=None):
if name==None:
d = Edit1Dialog(self.root,"Add Medialist",
"File", "")
if d.result == None:
return ''
name=str(d.result)
if name=="":
tkMessageBox.showwarning(
"Add medialist",
"Name is blank"
)
return ''
if not name.endswith(".json"):
name=name+(".json")
path = self.pp_profile_dir + os.sep + name
if os.path.exists(path)== True:
tkMessageBox.showwarning("Add medialist","Medialist file exists\n(%s)" % path)
return ''
nfile = open(path,'wb')
nfile.write("{")
nfile.write("\"issue\": \""+self.editor_issue+"\",\n")
nfile.write("\"tracks\": [")
nfile.write("]")
nfile.write("}")
nfile.close()
# append it to the list
self.medialists.append(copy.deepcopy(name))
# add title to medialists display
self.medialists_display.insert(END, name)
# and set it as the selected medialist
self.refresh_medialists_display()
return name
示例12: validate
def validate(self):
try:
self.result = (int(self.s_sx.get()), int(self.s_sy.get()), int(self.s_ox.get()), int(self.s_oy.get()))
return 1
except ValueError:
tkMessageBox.showwarning("Bad Input", "Only Integers allowed")
return 0
示例13: search
def search(cls, event=None):
"Search the text in the search_entry widget by creating a new instance "
"of the ConcurrentSearch class (after validating it by means of the "
"validate_question function in the question module), and depict the "
"results obtained in the results_listbox widget "
"The contents of the sv variable will be displayed on the "
"message_index widget, and updated by the thread responsible for "
"carrying out the index operation"
input = cls.search_entry.get()
cls.results_listbox.delete(0, END)
if question.validate_question_string(input):
cls.similar_button.pack(side=RIGHT, pady=10)
window_index = Toplevel(cls.top, width=200)
window_index.title("Buscando...")
window_index.wm_iconbitmap(bitmap="@python.xbm")
sv = StringVar()
message_index = Message(window_index, textvariable=sv, aspect=800)
message_index.pack(side=LEFT, fill=BOTH, expand=1)
t_search = cls.ConcurrentSearch(
output_stream=sv, results_output=cls.results_listbox, algorithm=cls.algorithm.get(), question=input
)
t_search.start()
else:
tkMessageBox.showwarning(
"Entrada no valida", "La pregunta realizada debe cumplir con el formato: (termino peso?)+\n"
)
示例14: _mouseWheel
def _mouseWheel(self, event):
"""
Mouse wheel moved
"""
# event.num == 4 -> up
# event.num == 5 -> down
#print "mouse wheel ",event
val = self.odf[self.selectedPar.get()]
pname = self.selectedPar.get()
try:
if self.modModus.get() == "add":
mf = float(self.modEntryTextAdd.get())
elif self.modModus.get() == "mul":
mf = float(self.modEntryTextMul.get())
except ValueError:
tkMessageBox.showwarning("Invalid float", "Cannot convert " + self.modEntry.get() + " to float." + \
" Make it a valid value to proceed.")
return
if event.num == 4:
if self.modModus.get() == "mul":
self.odf[pname] = val * mf
else:
self.odf[pname] = val + mf
elif event.num == 5:
if self.modModus.get() == "mul":
self.odf[pname] = val / mf
else:
self.odf[pname] = val - mf
self._parameterValueChanged()
示例15: paste_DNA
def paste_DNA(self,event=None):
"""Paste stuff"""
text=self.master.selection_get(selection = "CLIPBOARD")
# Check that we have DNA
import string
text=string.replace(text,'\n','')
text=string.replace(text,'\r','')
text=string.replace(text,' ','')
DNA=['A','C','G','T','a','c','g','t']
for letter in text:
if not letter in DNA:
tkMessageBox.showwarning('Invalid DNA sequence',
'"%s" is not a valid DNA sequence. \n"%s" is first illegal base.' %(text,letter),
parent=self.master)
return
# Make upper case
text=string.upper(text)
# ok
start=self.data['DNA_selection']['start']
stop=self.data['DNA_selection']['stop']
p_start=min(start,stop)
p_end=max(start,stop)
self.data['DNAseq']=self.data['DNAseq'][:p_start]+text+self.data['DNAseq'][p_end:]
self.clear_selection()
self.update_sequence_window()
return