本文整理汇总了Python中tkinter.messagebox.askquestion函数的典型用法代码示例。如果您正苦于以下问题:Python askquestion函数的具体用法?Python askquestion怎么用?Python askquestion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了askquestion函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: askUserBeforeDelete
def askUserBeforeDelete(self):
"This function is for dialog to ask user if he is sure."
messagebox.askquestion("Warning!", "This action will remove all files from destination folder. Are you sure?", icon="warning")
if 'yes':
self.syncronFolder()
else:
return 0
示例2: b4exit
def b4exit():
global print_date
global print_time
print_date = DATE()
print_time = TIME()
date_time = print_date + " - " + print_time
if(init_ready4newTrans == True):
quitORnot = messagebox.askquestion("Continue", "Exit program?", icon='warning')
if quitORnot == 'yes':
print("/////// Program is terminated //////////")
file = open(output_txt, 'a+')
file.write("\n///////////////////////// Program is terminated (" + date_time + ") /////////////////////////\n")
file.close()
root.destroy()
root.quit()
else:
continue_trans()
else:
quitORnot = messagebox.askquestion("Continue", "Exit program?\n...Current transaction will be removed", icon='warning')
if quitORnot == 'yes':
print("/////// Program is terminated //////////")
file = open(output_txt, 'a+')
file.write("\n=============== The transaction is canceled ===============\n")
file.write("\n///////////////////////// Program is terminated (" + date_time + ") /////////////////////////\n")
file.close()
root.destroy()
root.quit()
else:
continue_trans()
示例3: bob
def bob():
#add green door
ll = messagebox.askquestion("Mr.Bones","Would you like to wander about aimlessly?")
if ll == "yes":
messagebox.showerror("Mr.Bones","You stumbled upon a trap by falling into it.")
exec("GAME OVER")
lk = messagebox.askquestion("Mr.Bones","You see something in the distance. want to check it out?")
if lk == "yes":
messagebox.showerror("Mr.Bones","You see a green door. it needs a key of some kind.")
if "A Fuck to give" in room.grunnur.items:
messagebox.showerror("Mr.Bones","The given fuck Can open this door.")
messagebox.showerror("Mr.Bones","You found a red cane!")
messagebox.showerror("Mr.Bones","after twists and turns you see a straight path.")
bg = messagebox.askquestion("Mr.Bones","Will you turn right?")
if bg == "yes":
dod()
else:
messagebox.showerror("Mr.Bones","You DARE take a left?!?")
hg = messagebox.askquestion("Mr.Bones","A scary scary scarecrow stands before you. Will you dare to poke it?")
if hg == "no":
messagebox.showerror("Mr.Bones","You walk forward and the walls close on you. Killing you instantly.")
exec("GAME OVER")
messagebox.showerror("Mr.Bones","The scarecrow screaches unholy screams of terror that send chills down your spine.")
ki=messagebox.askquestion("Mr.Bones","Will you shit your pants?")
if ki == "no":
messagebox.showerror("Mr.Bones","You shat them anyway.")
bananaleave = room.grunnur(23)
bananaleave.go("s")
示例4: checkNotes
def checkNotes(self):
if len(self.notes.get(1.0, "end")) > 1:
self.submit()
else:
mb.askquestion(
title="Whoops!", message="You haven't entered any notes. Would you like to submit your job journal anyway?")
return False
示例5: bind_key
def bind_key(self, event):
'''
key event
'''
if model.is_over(self.matrix):
if askquestion("GAME OVER","GAME OVER!\nDo you want to init it?") == 'yes':
self.matrix = my_init()
self.btn_show_matrix(self.matrix)
return
else:
self.root.destroy()
else:
if event.keysym.lower() == "q":
self.root.destroy()
elif event.keysym == "Left":
self.matrix = model.move_left(self.matrix)
elif event.keysym == "Right":
self.matrix = model.move_right(self.matrix)
elif event.keysym == "Up":
self.matrix = model.move_up(self.matrix)
elif event.keysym == "Down":
self.matrix = model.move_down(self.matrix)
elif event.keysym.lower() == "b":
if len(matrix_stack) == 1:
showinfo('info', 'Cannot back anymore...')
else:
matrix_stack_forward.append(self.matrix)
matrix_stack.pop()
self.matrix = matrix_stack[-1]
elif event.keysym.lower() == "f":
if len(matrix_stack_forward) == 0:
showinfo('info', 'Cannot forward anymore...')
else:
self.matrix = matrix_stack_forward[-1]
matrix_stack_forward.pop()
matrix_stack.append(self.matrix)
if event.keysym in ["q", "Left", "Right", "Up", "Down"]:
try:
self.matrix = model.insert(self.matrix)
matrix_stack.append(self.matrix)
del matrix_stack_forward[0:]
except:
pass
try:
self.btn_show_matrix(self.matrix)
except:
pass
if model.is_win(self.matrix):
if askquestion("WIN","You win the game!\nDo you want to init it?") == 'yes':
self.matrix = my_init()
self.btn_show_matrix(self.matrix)
return
else:
self.root.destroy()
示例6: close
def close(self):
# ---------------------
if self.exit_mode == 'quit':
''' Closing the main widget '''
messagebox.askquestion('Close','Are you sure?',icon='warning')
if 'yes':
quit()
else:
self.master.destroy()
return
示例7: dod
def dod():
#leads to billy,bobby,asdf
#dead end
messagebox.showerror("Mr.Bones","Not all correct ways are to the right.")
kb = messagebox.askquestion("Mr.Bones","would you like to proceed?")
if kb == "yes":
messagebox.showerror("Mr.Bones","You tripped and died.")
exec("GAME OVER")
messagebox.showerror("Mr.Bones","Or...wait here.")
messagebox.showerror("Mr.Bones","You walk forward regardless of your will")
ko = messagebox.askquestion("Mr.Bones","You see a fork in the road. turn right?")
if ko == "no":
messagebox.showerror("Mr.Bones","You suddenly explode without reason.")
exec("GAME OVER")
kp = messagebox.askquestion("Mr.Bones","Strange. There is another fork in the rode you just chose...left?")
if kp =="yes":
billy()
ja = messagebox.askquestion("Mr.Bones","Yet another fork. Go right?")
if ja == "yes":
messagebox.showinfo("Mr.Bones","You step on a landmine.")
exec("GAME OVER BITCH!")
hf= messagebox.askquestion("Mr.Bones","these 'forks' seem to go on endlessly. Left? Yes? No?")
if hf =="yes":
bobby()
ge=messagebox.askquestion("Mr.Bones","Right?")
if ge=="yes":
asdf()
gh=messagebox.askquestion("Mr.Bones","right again?")
if gh =="yes":
messagebox.showerror("Mr.Bones","WRONG!!!")
exec("GAME OVER")
gq=messagebox.askquestion("Mr.Bones","Left?")
if gq=="yes":
messagebox.showerror("Mr.Bones","You step forward not knowing that the roof just caved in on you.")
exec("GAME OVER")
messagebox.showerror("Mr.Bones","You turn and turn, after thoushands of left and rights you see a sign.")
gf=messagebox.askquestion("Mr.Bones","Want to read it?")
if gf=="yes":
gj= messagebox.askquestion("Mr.Bones","It is a sign for the blind. Want to try reading it anyway?")
if gj=="yes":
messagebox.showinfo("Mr.Bones","It says 'Dead end bitch!'")
else:
messagebox.showerror("Mr.Bones","You choke on the sign.")
else:
messagebox.showinfo("Mr.Bones","you sit still. You sit still for a looooooong time.")
messagebox.showinfo("Mr.Bones","Yup....waiting.")
i = 0
while i != 20:
messagebox.showinfo("Mr.Bones","")
i += 1
messagebox.showerror("Mr.Bones","You suddenly starve. I wonder why")
exec("GAME OVER")
示例8: checkSave
def checkSave():
global currentFile
# Asks the user if they want to save; question changes depending on if the
# user has a new file or existing file open.
if currentFile:
choice = askquestion('Text Editor', 'Do you want to save changes to ' +
currentFile + '?')
else:
choice = askquestion('Text Editor', 'Do you want to save changes to' +
' Untitled?')
return choice
示例9: DaStar
def DaStar():
if mechanic == "open":
golden = messagebox.askquestion( 'k', 'Það er stytta og kött úr skýra gulli, viltu taka hana?')
if golden == 'yes':
room.grunnur.items.append('Gullni Kötturinn')
else:
background_label.grid(row=2, column=2)
B.grid(row=1, column=1)
G.grid(row=1, column=2)
C.grid(row=1, column=3)
else:
messagebox.askquestion( 'k', 'Þú þarft að opna fyrir lásinn í herbergi styrks')
top = tkinter.Tk()
pass
示例10: save_char
def save_char():
'''Writes character info to a .txt. file, saved by character name.'''
def save_to_file(file):
file.write(my_first_character.name + '\n')
file.write(str(my_first_character.level) + '\n')
file.write(my_first_character.race.print_race() + '\n')
file.write(str(my_first_character.strength) + '\n')
file.write(str(my_first_character.dexterity) + '\n')
file.write(str(my_first_character.constitution) + '\n')
file.write(str(my_first_character.intelligence) + '\n')
file.write(str(my_first_character.wisdom) + '\n')
file.write(str(my_first_character.spent_stat_points)) # no more lines needed
cwd = os.getcwd()
if os.path.exists(cwd + '\\character'):
pass # no need to create the folder if it exists already, pass on to next step
else:
os.makedirs(cwd + '\\character')
print("Created new directory to store character files")
if os.path.exists(cwd + '\\character\\' + my_first_character.name + '.txt'):
overwrite = messagebox.askquestion('Overwrite character?',
'Character already exists. Overwrite?')
if overwrite == 'yes':
char_file = open(cwd + '\\character\\' + my_first_character.name + '.txt', 'w+')
save_to_file(char_file)
char_file.close()
else:
messagebox.showinfo('Did not save',
'Did not save, did not overwrite existing file.')
else:
char_file = open(cwd + '\\character\\' + my_first_character.name + '.txt', 'w+')
save_to_file(char_file)
char_file.close()
示例11: next
def next(self, event):
result = messagebox.askquestion("Next", "Вы уверены, что хотите взять новую задачу? \n"
"(Вы получите 1 штрафной балл)",
icon='warning')
if result == 'no':
return
self.request('next')
示例12: silentExchangeQuestion
def silentExchangeQuestion(self, sock, addressIP, ID):
result = messagebox.askquestion("New Connection request","Would you like to connect to: " + ID + " at IP address: " + addressIP)
if result=="yes":
self.silentExchange(sock, addressIP)
else:
sock.send(Utils.FAILED_VERIFY_HEADER)
sock.close()
示例13: editiClickerFile
def editiClickerFile():
''' Called from editiClickerInfo. Sets the values for the variables
iclickerdict (dictionary of iClickerID (keys) and student ID (values)),
iclickerfile (csv file where the info for iclicker dict was stored as
second and first column respectively - yes the order in the csv file is
inverted with respect to the iclickerdict variable), and studentlist (list
of student IDs in the same order as user enters them, needed in addition to
iclickerdict because dictionaries are not ordered) using the filebrowser
and getiClickerData function. It then passes those values to
iClickerManager, a common interface for both createiClickerFile and
editiClickerFile'''
# Initialize the variables
# Get the file with the iClicker information
m1=messagebox.showinfo(message='Select CSV file with the iClicker \
information')
counter=0
while counter==0:
iclickerfile=filedialog.askopenfilename() #notice all lowercase
if iclickerfile=='':
m2=messagebox.askquestion(message='No file was selected \
\nDo you want to try again?')
if m2=='no': return #if no then go back to main menu
else:
# If got a filename extract the data
try:
studentlist, iclickerdict=getiClickerData(iclickerfile)
counter=1
except:
m3=messagebox.showinfo(message='There was a problem with the file\
\nPlease try again')
print('editiClickerFile')
return
示例14: exit
def exit(self, e=None):
confirm = messagebox.askquestion(
"Quit",
"Are you sure you want to quit?",
icon="warning")
if "yes" == confirm:
exit(0)
示例15: close_gui
def close_gui(self):
result = tkm.askquestion("made by carefree0910", "Backup?")
if result == "yes":
with open(self.path + "backup.dat", "wb") as file:
with open(self.path + "dic.dat", "rb") as f:
pickle.dump(pickle.load(f), file)
self.master.destroy()