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


Python messagebox.askyesno函数代码示例

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


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

示例1: sd_button_add_source

	def sd_button_add_source(self):
		"""This method will take the data fields for a source and add it.
		If the feed already exists, an offer to modify it will be made."""
		#lets gather the settings for the new source.
		name = self.sdo_name.get()
		url = self.sdo_url.get()
		source_time = self.sdo_time.get()
		#lets make sure we have both name and an address.
		if not url or not name:
			messagebox.showinfo(message=self._('To add a new source, you must give it a name and a URL.'))
		else:
			#now lets validate the time that was given.
			if source_time:
				source_time = self.__time_to_string__(self.__calculate_time__(source_time))
			else:
				source_time = '00:00:00 01/01/2000'
			reply = self.sd.add_source(name, url, source_time)
			if not reply[0] and reply[1] == 1:
				if messagebox.askyesno(message=self._('A feed with the name "{}" already exists, do you want to edit it ?').format(name), icon='question', title='Edit Feed'):
					if not self.sd.modify_source(name, url, source_time, by = 0)[0]:
						#that means that the given URL already exists in another feed.
						messagebox.showinfo(message=self._('The given URL already exists in another feed. No changes were made.'))
			elif not reply[0] and reply[1] == 0:
				if messagebox.askyesno(message=self._('A feed with the URL "{}" already exists, do you want to edit it ?').format(url), icon='question', title='Edit Feed'):
					if not self.sd.modify_source(name, url, source_time, by = 1)[0]:
						#that means that the given name already exists in another feed.
						messagebox.showinfo(message=self._('The given name already exists in another feed. No changes were made.'))
					else:
						self.__load_sd_feeds_list__()
			else:
				self.__load_sd_feeds_list__()
				self.stts_print()
		self.sd_clear()
开发者ID:yochai,项目名称:rssgraber,代码行数:33,代码来源:ginterface.py

示例2: dump

def dump(element):
    path_ = path.get()
    if path_ == '':
        return
    file_type = os.path.splitext(path_)[1]
    call = callable_arr.get(file_type)
    try:
        arr = call(path_)
    except Exception as e:
        print(e)
        messagebox.askokcancel('error', '不支持该文件类型')
        return
    if element == 'json':
        content = json.dumps(arr, sort_keys=True)

        with open(os.path.dirname(path_)+r'\target.json', 'w+') as f:
            f.write(content)
            messagebox.askyesno('成功', '转换成功!请查找target文件')
    elif element == 'php':
        php_str = '<?php \n' \
                  'return '
        php_str = php_str + dump_php(arr) + ';'
        with open(os.path.dirname(path_)+r'\target.php', 'wb') as f:
            f.write(php_str.encode())
            messagebox.askyesno('成功', '转换成功!请查找target文件')
开发者ID:wujunwei,项目名称:PythonTest,代码行数:25,代码来源:transform.py

示例3: listFiles

 def listFiles(self):
     request = False
     # Inventory is only created around 1 day after first file is upload
     if (self.Glacier.vault.last_inventory_date == None):
         request = messagebox.askyesno("No Inventory Found","Request Inventory from AWS Glacier?\nJob will take around 4-5 hours to complete.")
     else:
         d = dateutil.parser.parse( self.Glacier.vault.last_inventory_date )
         d.replace(tzinfo=None)
         days = (datetime.datetime.utcnow() - d.replace(tzinfo=None)).days
         hours = (datetime.datetime.utcnow() - d.replace(tzinfo=None)).seconds/3600.0
         hours = floor(hours*100)/100;
         # Amazon Glacier prepares an inventory for each vault periodically, every 24 hours.
         # When you initiate a job for a vault inventory, Amazon Glacier returns the last
         # inventory for the vault. The inventory data you get might be up to a day or
         # two days old.
         #
         # - So, we only request a new list if our current list is more than 2 days older
         # TODO: Here we need to check if we already have a inventory_retrieval job
         if (days >= 2):
             request = messagebox.askyesno("Inventory is " + str(days) + " days old","Request Inventory from AWS Glacier?\nJob will take around 4-5 hours to complete.")
         else:
             request = messagebox.askyesno("Inventory is " + str(hours) + " hours old","Request Inventory from AWS Glacier?\nJob will take around 4-5 hours to complete.")
             
     if (request):
         self.Glacier.initListFiles()
         #TODO: Add Message/Feedback
     else:
         # Use old data
         #TODO: Here, update self.inventory with archives information
         # Havent find a way to get old inventory data yet.. so will keep it locally
         print(self.Glacier.vault.number_of_archives)
         print(self.Glacier.vault.size_in_bytes)
开发者ID:wendelbsilva,项目名称:Backup2Glacier,代码行数:32,代码来源:main.py

示例4: check_deb

def check_deb(sl, at):
    global Broll, counter, tcol, deb_low, deb_con, sum_per
    Broll=cur_parti_Atte(sl)
    if ws.cell(row=sl+5, column=5).value==1:
        deb_con[counter]=1
        deb_lab2.configure(style='sl.TLabel')
    elif sum(Broll[1:5])+at==0:
        q=messagebox.askyesno(message='ALERT!!! Absent for 5 days Continuosly\nWant to DEBAR?', icon='question', title='DEBAR ALERT')
        deb_con[counter]=int(q)#Add 2 for today debarred student
        if q:
            deb_lab2.configure(style='sl.TLabel')
        else:
            deb_lab2.configure(style='un.TLabel')
    else:
        deb_con[counter]=0
        deb_lab2.configure(style='un.TLabel')
    if ws.cell(row=sl+5, column=4 ).value==1:
        if (ws.cell(row=sl+5, column=6).value+at)/(tcol-6)*100>75:
            messagebox.showinfo(message='CONGO!!! Your Attendance > 75% now\nYou have been cleared from DEBAR LIST')
            deb_low[counter]=0
        else:
            deb_low[counter]=1
            deb_lab1.configure(style='sl.TLabel')
    else:
        if (ws.cell(row=sl+5, column=6).value+at)/(tcol-6)*100<75:
            p=messagebox.askyesno(message='ALERT!!! Attendance < 75%\nWant to DEBAR?', icon='question', title='DEBAR ALERT')
            deb_low[counter]=int(p)#Add 2 for today debarred student
            if p:
                deb_lab1.configure(style='sl.TLabel')
            else:
                deb_lab1.configure(style='un.TLabel')
        else:
            deb_low[counter]=0
            deb_lab1.configure(style='un.TLabel')
    sum_per[counter] = str(round((ws.cell(row=sl+5, column=6).value+at)/(tcol-6)*100, 2))+'%'
    per.set(sum_per[counter])
    if sum(Broll)+at==0:
        warn3.set('ABSENT FOR MORE THAN 5 DAYS')
        war_lab1.configure(style='slw.TLabel')
        war_3[counter]=3
    elif sum(Broll[2:5])+at==0:
        warn3.set('WARNING!!! ABSENT FOR 4 DAYS')
        war_lab1.configure(style='slw.TLabel')
        war_3[counter]=2
    elif sum(Broll[3:5])+at==0:
        warn3.set('WARNING!!! ABSENT FOR 3 DAYS')
        war_lab1.configure(style='slw.TLabel')
        war_3[counter]=1
    else:
        warn3.set('----------------------------------')
        war_lab1.configure(style='warel.TLabel')
        war_3[counter]=0
    if 75<(ws.cell(row=sl+5, column=6).value+at)/(tcol-6)*100<80:
        warn75.set('WARNING!!! 75% < ATTENDANCE < 80%')
        war_lab2.configure(style='slw.TLabel')
        war_75[counter]=1
    else:
        warn75.set('----------------------------------')
        war_lab2.configure(style='warel.TLabel')
        war_75[counter]=0
开发者ID:SyDan,项目名称:ODD-Attendance,代码行数:60,代码来源:Newtest.py

示例5: submitViolation

 def submitViolation( self ):
     # Checks that user wants to submit with or without a description.
     askMsg = "Are you sure you want to submit the " +\
              "violation with no description?"
     if not self.descOpen:
         if not tm.askyesno( "No Description?", askMsg ):
             self.addTextWidget()
             return
         else:
             getDesc = None
     elif len( self.descBox.get( 1.0, END ).strip() ) == 0:
         if not tm.askyesno( "No Description?", askMsg ):
             return
         else:
             getDesc = None
     else:
         getDesc = self.descBox.get( 1.0, END ).strip()
 
     # create the entry dictionary for the statement
     self.entries = { "ticketNo":    self.ticketNo_entry.get().strip(),
                      "violatorNo":  self.violator_entry.get().strip(),
                      "vehicle_id":  self.vin_entry.get().strip(),
                      "officerNo":   self.officerNo_entry.get().strip(),
                      "vtype":       self.vType_entry.get().strip(),
                      "vdate":       self.vDate_entry.get().strip(),
                      "place":       self.loc_entry.get().strip(),
                      "descr":       getDesc                             }
 
     if not self.validateEntries():
         return
 
     askMsg = "Are you sure you want to submit?"
     if not tm.askyesno( "Submit Confirmation", askMsg ):
         return
             
     cursor = self.userCx.cursor()
    
     statement = "INSERT INTO ticket VALUES ( :ticketNo, :violatorNo, " +\
                 ":vehicle_id, :officerNo, :vtype, " +\
                 "TO_DATE( :vdate, 'dd-Mon-yyyy hh24:mi:ss' ), " +\
                 ":place, :descr )"
 
     cursor.execute( "SAVEPOINT Violation" )
     
     try:
         cursor.execute( statement, self.entries )
         cursor.execute( "COMMIT" )
     except cx_Oracle.DatabaseError as exc:
         cursor.execute( "ROLLBACK to Violation" ) 
         cursor.close()
         error, = exc.args
         self.recoverError( error )
         return
         
     cursor.close()
     infoMsg = "Ticket Number " + str( self.entries["ticketNo"] ) +\
               " has been recorded."
               
     tm.showinfo( "Success!", infoMsg )
     self.destroy()
开发者ID:devonupton,项目名称:auto-registration-system,代码行数:60,代码来源:violation_records.py

示例6: update_db

    def update_db(self, old=None, new=None, content=None, askoverwrite=True):
        if old is None:
            old = self.db_container.selected_file.get()
        if new is None:
            new = self.db_container.selected_file.get().strip('*')
        if content is None:
            content = self.db_container.editor.get("1.0", END).strip()

        if old == new and askoverwrite:
            savechanges = messagebox.askyesno("Save changes", "A file '{}' already exists. Overwrite?".format(new))
            if savechanges:
                self.project.dbs[old] = content
            else:
                logger.error('no name specified!')
                return -1
        elif old == new and not askoverwrite:
            self.project.dbs[old] = content
        else:
            if new in self.project.dbs:
                if askoverwrite:
                    savechanges = messagebox.askyesno("Save changes", "A file '{}' already exists. Overwrite?".format(new))
                    if savechanges:
                        self.project.dbs[new] = content
                    else:
                        logger.error('no name specified!')
                        return -1
            else:
                self.project.dbs[new] = content
        return 1
开发者ID:bbferka,项目名称:pracmln,代码行数:29,代码来源:mlnquery.py

示例7: FileDelete

 def FileDelete(self):
     """ Delete the working database """
     # Do we have a DB open?
     if self.DBHandle.DBConnection == None:
         # No DB to close
         self.WindowInfoMesg(1, "No open database")
     else:
         # Warn the user
         if messagebox.askyesno("WARNING", "This will delete the database file, proceed?"):
             # Ask again
             if messagebox.askyesno("Final Warning", "Are you sure you would like to delete the DB?"):
                 # Delete the database
                 if self.DBHandle.DBDestroy() == False:
                     # Error Occured
                     self.WindowInfoMesg(2, self.DBHandle.ErrorMsg)
                 else:
                     # DB deleted double check
                     if ops.path.isfile(self.DBFileName):
                         # File shouldn't exist!
                         self.WindowInfoMesg(2, "File didn't delete!")
                     else:
                         # File is gone
                         self.WindowInfoMesg(0, "Database Deleted")
             else:
                 # Do nothing
                 pass
         else:
             # Do nothing
             pass
开发者ID:savisitor15,项目名称:CharacterDB,代码行数:29,代码来源:classGUI.py

示例8: _maybeMigrateFromFGoConfig_dialogs

    def _maybeMigrateFromFGoConfig_dialogs(self, parent):
        message = _("Initialize {prg}'s configuration from your existing " \
                    "FGo! configuration?").format(prg=PROGNAME)
        detail = (_("""\
You have no {cfgfile} file but you do have a {fgo_cfgfile} file,
which normally belongs to FGo!. Except in rare circumstances
(such as using braces or backslashes, or opening brackets at the
beginning of a config line), a configuration file from
FGo! 1.5.5 or earlier should be usable as is by {prg}.""")
                  .replace('\n', ' ') + "\n\n" + _("""\
If {fgo_cfgfile} was written by FGo! 1.5.5 or earlier, you
should probably say “Yes” here in order to initialize {prg}'s
configuration based on your FGo! config file (precisely:
copy {fgo_cfgfile} to {cfgfile}).""")
                  .replace('\n', ' ') + "\n\n" + _("""\
If {fgo_cfgfile} was written by a version of FGo! that is greater
than 1.5.5, it is advised to say “No” here.""")
                  .replace('\n', ' ')
                 ).format(prg=PROGNAME, cfgfile=CONFIG, fgo_cfgfile=FGO_CONFIG)

        if askyesno(PROGNAME, message, detail=detail, parent=parent):
            choice = "migrate from FGo!"
        else:
            message = _("Create a default {prg} configuration?").format(
                prg=PROGNAME)
            detail = _("""\
Choose “Yes” to create a basic {prg} configuration now. If you
choose “No”, {prg} will exit and you'll have to create {cfgfile}
yourself, or restart {prg} to see the same questions again.""") \
                     .replace('\n', ' ').format(prg=PROGNAME, cfgfile=CONFIG)

            if askyesno(PROGNAME, message, detail=detail, parent=parent):
                choice = "create default cfg"
                message = _("Creating a default {prg} configuration.").format(
                    prg=PROGNAME)
                detail = (_("""\
It is suggested that you go to the Settings menu and choose
Preferences to review your newly-created configuration.""")
                          .replace('\n', ' ') + "\n\n" + _("""\
You can also reuse most, if not all FlightGear options you
had in FGo!'s main text box (the “options window”). Just copy
them to the corresponding {prg} text box.""")
                          .replace('\n', ' ') + "\n\n" + _("""\
Note: you may run both FGo! and {prg} simultaneously, as their
configurations are kept separate.""")
                          .replace('\n', ' ')
                         ).format(prg=PROGNAME)
                showinfo(PROGNAME, message, detail=detail, parent=parent)
            else:
                choice = "abort"

        return choice
开发者ID:carmen890,项目名称:FFGo,代码行数:52,代码来源:config.py

示例9: onQuit

 def onQuit(self):                              # on a Quit request in the GUI
     close = not self.text_edit_modified()      # check self, ask?, check others
     if not close:
         close = askyesno('SimpleEditor', 'Text changed: quit and discard changes?')
     if close:
         windows = TextEditor.editwindows
         changed = [w for w in windows if w != self and w.text_edit_modified()]
         if not changed:
             GuiMaker.quit(self) 
         else:
             numchange = len(changed)
             verify = '%s other edit window%s changed: quit and discard anyhow?'
             verify = verify % (numchange, 's' if numchange > 1 else '')
             if askyesno('SimpleEditor', verify):
                 GuiMaker.quit(self)
开发者ID:leksokmy,项目名称:TheSimpleTextEditor,代码行数:15,代码来源:textEditor.py

示例10: onQuit

 def onQuit(self):  # on a Quit request in the GUI
     close = not self.text_edit_modified()  # check self, ask?, check others
     if not close:
         close = askyesno("PyEdit", "Text changed: quit and discard changes?")
     if close:
         windows = TextEditor.editwindows
         changed = [w for w in windows if w != self and w.text_edit_modified()]
         if not changed:
             GuiMaker.quit(self)  # quit ends entire app regardless of widget type
         else:
             numchange = len(changed)
             verify = "%s other edit window%s changed: quit and discard anyhow?"
             verify = verify % (numchange, "s" if numchange > 1 else "")
             if askyesno("PyEdit", verify):
                 GuiMaker.quit(self)
开发者ID:liubiggun,项目名称:PP4E,代码行数:15,代码来源:_unthreaded-textEditor.py

示例11: onQuit

 def onQuit(self):
     close = not self.text.edit_modified()
     if not close:
         close = askyesno('PyEdit', 'Text changed: quit and discard changes?')
     if close:
         windows = TextEditor.editwindows
         changed = [w for w in windows if w != self and w.text.edit_modified()]
         if not changed:
             GuiMaker.quit(self)
         else:
             numchange = len(changed)
             verify = '%s other edit window%s changed: quit and discard anyhow?'
             verify = verify % (numchange, 's' if numchange > 1 else '')
             if askyesno('PyEdit', verify):
                 GuiMaker.quit(self)
开发者ID:death-finger,项目名称:Scripts,代码行数:15,代码来源:textEditor.py

示例12: clearLogs

 def clearLogs() :
     choice = messagebox.askyesno(title = "Clear Logs?", message = "Would you like to delete the application's logs?")
     if choice == True :
         try :
             os.remove('ERROR_LOG.txt')
         except IOError :
             pass
开发者ID:charlesbos,项目名称:s-compare,代码行数:7,代码来源:main.py

示例13: save

    def save(self, *tab):
        """Save the contents of the textbox"""
        if tab is int():
            tabToSave = tab
        else:
            tabToSave = self.selectedTab

        self.updateFilename()

        if (self.tabs[tabToSave].changed or
                self.master.master.textFrame.changed):
            yesno = messagebox.askyesno(
                title="Save note?",
                message="The tab has been changed. Would you like to save?")

            if yesno:
                a = self.master.master.saveFile(1)
                b = self.master.master.saveFile(4)
                if a == 1 or b == 1:
                    return 1
                else:
                    return 0
            else:
                return 0

        else:
            return 0
开发者ID:Luxtylo,项目名称:NoteVelocity,代码行数:27,代码来源:tabs.py

示例14: 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

示例15: reset

def reset() :
    rmFilesFailed = False
    question = "The following files will be deleted:\n\n    ~/.gtkrc-2.0\n    ~/.config/gtk-3.0/settings.ini\n    ~/.icons/default/index.theme\n\nDo you want to continue?"
    choice = messagebox.askyesno(title = "Reset", message = question)
    if choice :
        homeDir = os.path.expanduser('~')
        try : os.remove(homeDir + "/.gtkrc-2.0")
        except FileNotFoundError : pass
        except IOError : rmFilesFailed = True
        try : os.remove(homeDir + "/.config/gtk-3.0/settings.ini")
        except FileNotFoundError : pass
        except IOError : rmFilesFailed = True
        try : os.remove(homeDir + "/.icons/default/index.theme")
        except FileNotFoundError : pass
        except IOError : rmFilesFailed = True
        if rmFilesFailed : messagebox.showerror(title = "Error", message = "Errors occured whilst removing the settings files.")
        ui.varOpG2.set(getResource("gtk2", "gtk-theme-name"))
        ui.varOpG3.set(getResource("gtk3", "gtk-theme-name"))
        ui.varOpFont.delete(0, len(ui.varOpFont.get()))
        ui.varOpFont.insert(0, getResource("gtk2", "gtk-font-name"))
        ui.varOpIcons.set(getResource("gtk2", "gtk-icon-theme-name"))
        ui.varOpCursors.set(getResource("xdg_cursor", "Inherits"))
        ui.varOpButtonImages.set(getResource("gtk2", "gtk-button-images"))
        ui.varOpMenuImages.set(getResource("gtk2", "gtk-menu-images"))
        ui.varOpDarkTheme.set(getResource("gtk3", "gtk-application-prefer-dark-theme"))
开发者ID:charlesbos,项目名称:my-scripts,代码行数:25,代码来源:setgtktheme.py


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