• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python messagebox.askyesno函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: exit

 def exit(self):
     if messagebox.askyesno("","Do you wish to save before quitting?"):
         self.save()
         self.move()
     else:
         self.save()
         self.move()
开发者ID:louisxv,项目名称:DQS,代码行数:7,代码来源:lessons.py


示例17: apply

 def apply(self):
     """Apply operation"""
     kwds = {}
     method = self.opvar.get()
     for i in self.opts:
         if i not in self.grps[method]:
             continue
         if self.opts[i]['type'] == 'listbox':
             val = self.tkvars[i].getSelectedItem()
         else:
             val = self.tkvars[i].get()
         if val == '':
             val=None
         kwds[i] = val
     print (kwds)
     if method == 'merge':
         s=(kwds['suffix1'],kwds['suffix2'])
         del kwds['suffix1']
         del kwds['suffix2']
         m = pd.merge(self.df1,self.df2,on=None,suffixes=s, **kwds)
     elif method == 'concat':
         m = pd.concat([self.df1,self.df2], **kwds)
     print (m)
     #if successful ask user to replace table and close
     if len(m) > 0:
         n = messagebox.askyesno("Join done",
                                  "Merge/concat success.\nReplace table with new data?",
                                  parent=self.parent)
         if n == True:
             self.merged = m
             self.quit()
         else:
             self.merged = None
     return
开发者ID:freedream520,项目名称:pandastable,代码行数:34,代码来源:dialogs.py


示例18: pesquisar_atribuir_pessoa

    def pesquisar_atribuir_pessoa(self):
        if self.edt_pessoa.get() != self.desc_pessoa:
            dado = self.pesquisar(self.pessoas, 'cpf', 'nome',
                                  filtro="cpf ILIKE '%%%s%%' OR nome ILIKE '%%%s%%'" %
                                         (self.edt_pessoa.get(), self.edt_pessoa.get()),
                                  quantidade=(1,))
            if dado:
                self.cpf_pessoa = dado[0][0]
                self.edt_pessoa.delete(0, 'end')
                self.edt_pessoa.insert(0, dado[0][1])
            else:
                self.cpf_pessoa = ""

                if askyesno("Atenção", "Deseja cadastrar a pessoa %s" % self.edt_pessoa.get()):
                    pessoas = FrmPessoas(self, self.pessoas)
                    if self.edt_pessoa.get()[0] in string.digits:
                        pessoas.edt_cpf.delete(0, 'end')
                        pessoas.edt_cpf.insert(0, self.edt_pessoa.get())
                    else:
                        pessoas.edt_nome.insert(0, self.edt_pessoa.get())

                    # Se não fechar o form. FrmContas
                    if not self.wait_window(pessoas):
                        self.pesquisar_atribuir_pessoa()
                else:
                    self.edt_pessoa.delete(0, 'end')
                    self.edt_pessoa.insert(0, self.desc_pessoa)
开发者ID:paulocsilvajr,项目名称:python-code,代码行数:27,代码来源:controle_contas.py


示例19: remove_game

def remove_game(_=None):
    """Remove the currently-chosen game from the game list."""
    global selected_game
    lastgame_mess = (
        "\n (BEE2 will quit, this is the last game set!)"
        if len(all_games) == 1 else
        ""
    )
    confirm = messagebox.askyesno(
        title="BEE2",
        message='Are you sure you want to delete "'
                + selected_game.name
                + '"?'
                + lastgame_mess,
        )
    if confirm:
        selected_game.edit_gameinfo(add_line=False)

        all_games.remove(selected_game)
        config.remove_section(selected_game.name)
        config.save()

        if not all_games:
            UI.quit_application()  # If we have no games, nothing can be done

        selected_game = all_games[0]
        selectedGame_radio.set(0)
        add_menu_opts(game_menu)
开发者ID:xDadiKx,项目名称:BEE2.4,代码行数:28,代码来源:gameMan.py


示例20: playGame

def playGame(game):
    result = ''
    while not result:
        printGame(game)
        choice = input('Cell[1-9 or q to quit]: ')
        if choice.lower()[0] == 'q':
            save = mb.askyesno("Save game", "Save game before quitting?")
            if save:
                oxo_logic.saveGame(game)
            quit()
        else:
            try:
            	cell = int(choice) - 1
            	if not (0 <= cell <= 8):
            		raise ValueError
            except ValueError:
                print('Choose a number between 1 and 9 or q to quit')
                continue

            try:
                result = oxo_logic.userMove(game, cell)
            except ValueError:
                mb.showerror("Invalid cell", "Choose an empty cell")
                continue
            if not result:
                result = oxo_logic.computerMove(game)
            if not result:
                continue
            elif result == 'D':
                printGame(game)
                mb.showinfo("Result", "It's a draw")
                print("It's a draw")
            else:
                printGame(game)
                mb.showinfo("Result", "Winner is {}".format(result))
开发者ID:DanOswalt,项目名称:oxogame,代码行数:35,代码来源:oxo_ui.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python messagebox.askyesnocancel函数代码示例发布时间:2022-05-27
下一篇:
Python messagebox.askquestion函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap