当前位置: 首页>>代码示例>>Python>>正文


Python messagebox.showwarning函数代码示例

本文整理汇总了Python中tkinter.messagebox.showwarning函数的典型用法代码示例。如果您正苦于以下问题:Python showwarning函数的具体用法?Python showwarning怎么用?Python showwarning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了showwarning函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ok

    def ok(self):
        urlname = self.name.get().strip()
        url = self.url.get().strip()

        if urlname == '' or url == '':
            messagebox.showwarning('警告', '输入不能为空!')
            return

        # if self.parent.urllist.has_key(self.parent.name): # has_key() 方法
        if urlname in self.parent.urllist:
            if messagebox.askyesno('提示', '名称 ‘%s’ 已存在,将会覆盖,是否继续?' % urlname):
                pass
            else:
                return

        # 顯式地更改父窗口參數
        # self.parent.name = urlname
        # self.parent.url = url

        self.parent.urllist[urlname] = url

        # 重新加载列表
        self.parent.listbox.delete(0, END)
        for item in self.parent.urllist:
            self.parent.listbox.insert(END, item)
        self.destroy()  # 銷燬窗口
开发者ID:hooloong,项目名称:gitpython,代码行数:26,代码来源:favor_tool.py

示例2: stop_parsing

 def stop_parsing(self):
     """Stop the results process"""
     if self.parser._scoreboard_parser is not None:
         messagebox.showwarning("Warning", "Parsing cannot be stopped while results a scoreboard.")
         return
     self.parsing_control_button.config(state=tk.DISABLED)
     self.parsing_control_button.update()
     if self.minimap_enabled.get() is True and self.minimap is not None:
         self.minimap.destroy()
     self.close_overlay()
     self.parser.stop()
     self.parsing_control_button.config(text="Start Parsing", command=self.start_parsing)
     time.sleep(0.1)
     try:
         self.parser.join(timeout=2)
     except Exception as e:
         messagebox.showerror("Error", "While real-time results, the following error occurred:\n\n{}".format(e))
         raise
     self.watching_stringvar.set("Watching no file...")
     print("[RealTimeFrame] RealTimeParser reference count: {}".format(sys.getrefcount(self.parser)))
     self.parser = None
     self.close_overlay()
     DiscordClient().send_recent_files(self.window)
     self.window.update_presence()
     self.parsing_control_button.config(state=tk.NORMAL)
     self.data.set(self.DATA_STR_BASE.format("Not real-time results\n"))
开发者ID:RedFantom,项目名称:GSF-Parser-Public,代码行数:26,代码来源:realtime.py

示例3: addProduct

 def addProduct(*args):
     """
     This adds the currently selected product using information from a database that is fetched by the ShoppingCart class
     and then stored in Product and Material objects.
     """
     if (selectedProductVar.get() != "<Product>"):
         indx = self.possibleProductNames.index(selectedProductVar.get())
         product, messages = ShoppingCart.AddProduct(self.possibleProductIds[indx], productNumber.get())
         
         #There are several possible messages we might get back after trying to add a product. Let's display those to the user first.
         for msg in messages:
             messagebox.showwarning("Possible Problem", msg)
         
         if (product != None):
             newProd = (product.columnInfo["ProductDescription"], product.columnInfo["ProductFinish"], product.quantity)
             
             #First check to see if the product and its materials exist already!
             #There should only be 1 instance of each product and material in the tables.
             if (self.productTable.exists(product.PK)):
                 self.productTable.item(product.PK, values=newProd)
             else:
                 self.productTable.insert("", "end", iid=product.PK, values=newProd)
             
             AdjustColumnWidths(self.productTable, self.productHeader, self.productColWidth, newProd)
             
             sortby(self.productTable, self.productHeader[0], False)
开发者ID:DrewB66,项目名称:CS445-Database-Connection,代码行数:26,代码来源:main.py

示例4: mem_new

 def mem_new(self, c=[0]):
     from my_class import Member
     new = self.name.get(), self.abbr.get(), self.level.get(), self.rank.get()
     if not new[0]: return
     flag = not new[1]
     kw = {}
     kw['name'], kw['abbr'], kw['level'], kw['rank'] = new
     kw['abbr'] = ( kw['abbr'] or '%d'%c[0] ).rjust(3,'_')
     kw['level'] = int (kw['level'] or 1)
     kw['rank'] = kw['rank'] or kw['level'] * 100
     title = "添加成员"
     message = "新成员信息:\n  Name: %s\n  Abbr: %s\n  Town Hall Lv: %s\n  Rank: %s"\
               ""%(kw['name'], kw['abbr'], kw['level'], kw['rank'])
     if kw['abbr'] in self.clan.member:
         messagebox.showwarning("错误!","该缩写已存在,如需帮助请联系Ceilopty")
         return
     if not messagebox.askyesno(title, message): return
     try:
         new = Member(self.clan, **kw)
         self.clan[kw['abbr']] = new
     except BaseException as e:
         messagebox.showwarning("成员创建失败","错误:%s\n如有疑问请咨询Ceilopty"%e)
     else:
         self.unsaved = True
         if flag: c[0] += 1
         messagebox.showinfo("成员创建成功","即日起成员%s可以参战!"%kw['name'])
         self.flash()
开发者ID:Ceilopty,项目名称:coc-war-manager,代码行数:27,代码来源:my_menu.py

示例5: open

 def open(self, *args):
     """
     open a file on your computer
     return data
     """
     self.fname.set(askopenfilename(filetypes=[("text file", ".txt")],
                                    parent=self.window,
                                    title="Open a file"))
     try:
         self.data, self.time_sample = load_file(self.fname.get())[1:]
         self.time_sample = 1 / self.time_sample
     except FileNotFoundError:
         pass
     except FileError:
         showwarning(title="Error",
                     message="Can't read file {}!".format(self.fname.get()),
                     parent=self.window)
     else:
         self.fshortname.set(self.fname.get().split("/")[-1])
         self.flenght.set(len(self.data) / self.time_sample)
         self.time["start"].set(0)
         self.time["end"].set(self.flenght.get())
         self.amplitude["start"].set(min(self.data) - 10)
         self.amplitude["end"].set(max(self.data) + 10)
         self.refresh()
     return
开发者ID:Houet,项目名称:Japon,代码行数:26,代码来源:main.py

示例6: checkName

 def checkName(name):
     if name == '':
         messagebox.showwarning("Whoops", "Name should not be blank.")
         return 0
     if name in names:
         messagebox.showwarning("Name exists", "Sheet name already exists!")
         return 0
开发者ID:mgiorno,项目名称:pandastable,代码行数:7,代码来源:app.py

示例7: deleteRecord

def deleteRecord():
    """this function only shows warning, no record editing possible"""
    logging.info('deleteRecord: ')
    popup = Toplevel(c, takefocus=True) # child window
    popup.wm_title("Usuwanie wpisu z tabeli %s" % gTable)
    popLabel = ttk.Label(popup, text="Czy na pewno chcesz usunąć ten wpis?")
    yesButton = ttk.Button(popup, text="Tak", command=lambda: writeDeleteRecord(ID, popup))
    noButton = ttk.Button(popup, text="Nie", command=lambda: closePopup(popup), default='active')
    
    popLabel.grid(column=0, row=0, padx=5, pady=5, columnspan=2)
    yesButton.grid(column=0, row=1)
    noButton.grid(column=1, row=1)

    if not lbox.curselection():
        logging.warning('pop-up : nie zaznaczono rekordu do modyfikacji')
        messagebox.showwarning(
            "Usuwanie rekordu",
            "Nie zaznaczono rekordu do usunięcia"
        )
        return
     
    # get the selected record id       
    selection = lbox.curselection()
    recordString = lbox.get(selection[0])
    logging.debug('%r' % recordString)
    ID = recordString.split(' ; ')[-1] # ID is after ; in listbox
    logging.debug('%r' % ID)
    
    deleteID.set(updateString + ' ; ' + ID)
    logging.debug("updateString: %r" % updateString)
开发者ID:Qbicz,项目名称:TkBase,代码行数:30,代码来源:TkBase.py

示例8: ev_displayOPD

    def ev_displayOPD(self):
        self._updateFromGUI()
        if self.inst.pupilopd is None:
            tkMessageBox.showwarning( message="You currently have selected no OPD file (i.e. perfect telescope) so there's nothing to display.", title="Can't Display")
        else:
            if self._enable_opdserver and 'ITM' in self.opd_name:
                opd = self.inst.pupilopd   # will contain the actual OPD loaded in _updateFromGUI just above
            else:
                opd = fits.getdata(self.inst.pupilopd[0])     # in this case self.inst.pupilopd is a tuple with a string so we have to load it here.

            if len(opd.shape) >2:
                opd = opd[self.opd_i,:,:] # grab correct slice

            masked_opd = np.ma.masked_equal(opd,  0) # mask out all pixels which are exactly 0, outside the aperture
            cmap = matplotlib.cm.jet
            cmap.set_bad('k', 0.8)
            plt.clf()
            plt.imshow(masked_opd, cmap=cmap, interpolation='nearest', vmin=-0.5, vmax=0.5)
            plt.title("OPD from %s, #%d" %( os.path.basename(self.opd_name), self.opd_i))
            cb = plt.colorbar(orientation='vertical')
            cb.set_label('microns')

            f = plt.gcf()
            plt.text(0.4, 0.02, "OPD WFE = %6.2f nm RMS" % (masked_opd.std()*1000.), transform=f.transFigure)

        self._refresh_window()
开发者ID:mperrin,项目名称:webbpsf,代码行数:26,代码来源:tkgui.py

示例9: validate

    def validate(self):
        """Verify that a name was defined and only one between data and
        image path was set."""
        img_name = self.img_name.get()
        img_path = self.img_path.get()
        img_data = self.img_data.get('1.0', 'end').strip()

        if not img_name or (img_path and img_data) or \
            (not img_path and not img_data):
            showwarning("Invalid image specification",
                "You need to specify an image name and then either specify "
                "a image path or the image data, at least.", parent=self)
            return False

        try:
            img_format = self.img_format.get()
            if self._editing:
                # try to create an image with current settings, if it succeeds
                # then it is ok to change the image being edited.
                self._create_image(None, img_path, img_data, img_format)
                self._change_image(img_path, img_data, img_format)
            else:
                self._create_image(img_name, img_path, img_data, img_format)
        except Tkinter.TclError as err:
            showerror("Error creating image", err, parent=self)
            return False
        else:
            return True
开发者ID:askobeldin,项目名称:mypython3,代码行数:28,代码来源:theming.py

示例10: updateRecord

def updateRecord():
    logging.info('updateRecord: ')
    child = Toplevel(c, takefocus=True) # child window
    child.wm_title("Modyfikacja wpisu w tabeli %s" % gTable)
    e = Entry(child, textvariable = updateEntry, width=70)
    ok = ttk.Button(child, text = 'OK', command=lambda: writeUpdateRecord(child), default='active') # refactor to class with self.updateWindow
    
    e.grid(column=1, row=1, sticky=W)
    ok.grid(column=2, row=1, sticky=W)
    e.focus_set()
    
    if not lbox.curselection():
        logging.warning('pop-up : nie zaznaczono rekordu do modyfikacji')
        messagebox.showwarning(
            "Modyfikacja rekordu",
            "Nie zaznaczono rekordu do modyfikacji"
        )
        child.destroy()
        return
     
    # get the selected record id       
    selection = lbox.curselection()
    recordString = lbox.get(selection[0])
    logging.debug('%r' % recordString)
    ID = recordString.split(' ; ')[-1] # ID is after ; in listbox
    logging.debug('%r' % ID)
    
    cursor.execute('SELECT * FROM %s WHERE ID = %s' % (gTable, ID))
    tupleString = cursor.fetchone()
    updateString = ' ; '.join(str(x) for x in tupleString[1:]) # take subset without ID
    
    # save to state variable and add ID information
    updateEntry.set(updateString + ' ; ' + ID)
    logging.debug("updateString: %r" % updateString)
开发者ID:Qbicz,项目名称:TkBase,代码行数:34,代码来源:TkBase.py

示例11: submitComplaintButtonClicked

 def submitComplaintButtonClicked(self):
     #submit the complaint to database
     restaurant = self.complaintInfoList[0].get().split(',')[0]
     self.cursor.execute("SELECT rid FROM restaurant WHERE name = %s", restaurant)
     restaurantID = self.cursor.fetchone()[0]
     phone = self.complaintInfoList[4].get()
     cdate = self.complaintInfoList[1].get()
     customerFirstName = self.complaintInfoList[2].get()
     customerLastName = self.complaintInfoList[3].get()
     '''
     address = self.complaintInfoList[0].get().split(', ', 1)[1]
     print("address: " + address)
     self.cursor.execute("SELECT email FROM restaurant WHERE name = %s", restaurant)
     operatorEmail = self.cursor.fetchone()[0]
     print("email: " + operatorEmail)
     self.cursor.execute("SELECT firstname, lastname FROM operatorowner WHERE email = %s", operatorEmail)
     nameTuple = self.cursor.fetchall()
     operatorName = nameTuple[0][0] + ' ' + nameTuple[0][1]
     print(operatorName)
     self.cursor.execute("SELECT totalscore FROM inspection WHERE rid = %s ORDER BY idate DESC", restaurantID)
     score = self.cursor.fetchone()[0]
     print("score: " + str(score))
     '''
     complaint = self.complaintInfoList[-1].get()
     result = self.cursor.execute("SELECT * FROM customer WHERE phone = %s", phone)
     if not result:
         self.cursor.execute("INSERT INTO customer (phone, firstname, lastname) VALUES (%s, %s, %s)",
                         (phone, customerFirstName, customerLastName))
         self.db.commit()
     self.cursor.execute("INSERT INTO complaint (rid, phone, cdate, description) VALUES (%s, %s, %s, %s)",
                         (restaurantID, phone, cdate, complaint))
     self.db.commit()
     messagebox.showwarning("Submission Successful!", "Your complaint has been submitted.")
     self.fileComplaintWindow.withdraw()
     self.guestMenuWindow.deiconify()
开发者ID:itsxiaoxiaoxiaoxiaoyu,项目名称:CS-4400-Georgia-Restaurant-Inspections-report-database,代码行数:35,代码来源:Guest.py

示例12: show_test_vad_open

 def show_test_vad_open(self, path=path_to_test):
     askopenfile = filedialog.askopenfile(filetypes=[("Wave audio files", "*.wav *.wave")], defaultextension=".wav",
                                          initialdir=path)
     if not askopenfile is None:
         test(WavFile(askopenfile.name), self.nbc)
     else:
         messagebox.showwarning("Warning", "You should select one file. Please, try again")
开发者ID:KOlexandr,项目名称:Audio,代码行数:7,代码来源:Window.py

示例13: start

 def start(self):
     # Validate self.entry and begin
     path = self.entry.get()
     if os.path.exists(path):
         if os.path.isfile(path):
             try:
                 bank = testbank.parse(path)
                 engine = teach_me.FAQ(bank)
             except xml.sax._exceptions.SAXParseException as error:
                 title = error.getMessage().title()
                 LN = error.getLineNumber()
                 CN = error.getColumnNumber()
                 message = 'Line {}, Column {}'.format(LN, CN)
                 showerror(title, message, master=self)
             except AssertionError as error:
                 title = 'Validation Error'
                 message = error.args[0]
                 showerror(title, message, master=self)
             except:
                 title = 'Error'
                 message = 'Unknown exception was thrown!'
                 showerror(title, message, master=self)
             else:
                 self.done = False
                 self.next_event = iter(engine).__next__
                 self.after_idle(self.execute_quiz)
         else:
             title = 'Warning'
             message = 'File does not exist.'
             showwarning(title, message, master=self)
     else:
         title = 'Information'
         message = 'Path does not exist.'
         showinfo(title, message, master=self)
开发者ID:jacob-carrier,项目名称:code,代码行数:34,代码来源:recipe-577525.py

示例14: loadfunc

 def loadfunc() :
     #self.readpaste( filename, info_text ) 
     for i, l in enumerate(open( contrast_fn )) :
         v1, v2 = l.split('\t')
         v1 = v1.strip()
         v2 = v2.strip()
         
         if v1 :
             try : assert v1 in groups
             except :
                 showwarning('WARNING', 'Group name is not in the selection list!' )
                 print( 'v1:',v1 ) 
                 print( 'group:', groups )
                 continue
         
         if v2 :
             try: assert v2 in groups
             except :
                 showwarning('WARNING', 'Group name is not in the selection list!' )
                 print( 'v2:',v2 ) 
                 print( 'group:', groups )
                 continue
         
         contrast_vars[i][0].set(v1)
         contrast_vars[i][1].set(v2)
开发者ID:felloumi,项目名称:Pipeliner,代码行数:25,代码来源:epigenomeseq.py

示例15: update_excel

 def update_excel(self):
     if '__kopia__pliku__.xlsx' not in self.file_path and self.count == True:
         messagebox.showwarning(title=None,
                                message="Dla kolejnych odznaczen ustaw sciezke dla nowo stworzonego pliku kopii!")
     else:
         try:
             if self.E2.get().isdigit():
                 find_value = int(self.E2.get())
             else:
                 find_value = self.E2.get()
             book = load_workbook(self.file_path)
             # color_fill = PatternFill(patternType='solid', fgColor=Color('56FFE9'))
             orange = PatternFill(patternType='solid', fgColor=Color('FFFFC000'))
             sheets = book.get_sheet_names()
             check_amount = 0
             for count, sheet in enumerate(sheets):
                 sheet = book.get_sheet_by_name(sheets[count])
                 for row in sheet.rows:
                     for cell in row:
                         if cell.value == find_value:
                             check_amount += 1
                             cell.fill = orange
             if check_amount == 0:
                 messagebox.showinfo(title=None, message="Odznaczenie nie powiodło sie")
             else:
                 book.save('__kopia__pliku__.xlsx')
                 self.count = True
                 messagebox.showinfo(title=None, message="Pomyslnie zaktualizowano dokument")
         except:
             messagebox.showwarning(title="Uwaga", message="Sprobuj ponownie wybrac plik!")
开发者ID:lukaszgon,项目名称:xlapp_python,代码行数:30,代码来源:xlapp.py


注:本文中的tkinter.messagebox.showwarning函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。