天天看點

python messagebox彈窗退出_Python messagebox.showinfo方法代碼示例

本文整理彙總了Python中tkinter.messagebox.showinfo方法的典型用法代碼示例。如果您正苦于以下問題:Python messagebox.showinfo方法的具體用法?Python messagebox.showinfo怎麼用?Python messagebox.showinfo使用的例子?那麼恭喜您, 這裡精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在子產品tkinter.messagebox的用法示例。

在下文中一共展示了messagebox.showinfo方法的25個代碼示例,這些例子預設根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點贊,您的評價将有助于我們的系統推薦出更棒的Python代碼示例。

示例1: find

​點贊 6

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def find(self, text_to_find):

length = tk.IntVar()

idx = self.search(text_to_find, self.find_search_starting_index, stopindex=tk.END, count=length)

if idx:

self.tag_remove('find_match', 1.0, tk.END)

end = f'{idx}+{length.get()}c'

self.tag_add('find_match', idx, end)

self.see(idx)

self.find_search_starting_index = end

self.find_match_index = idx

else:

if self.find_match_index != 1.0:

if msg.askyesno("No more results", "No further matches. Repeat from the beginning?"):

self.find_search_starting_index = 1.0

self.find_match_index = None

return self.find(text_to_find)

else:

msg.showinfo("No Matches", "No matching text found")

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:23,

示例2: success

​點贊 6

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def success(sb2path, warnings, gui):

if gui:

if warnings == 0:

messagebox.showinfo("Success", "Completed with no warnings")

elif warnings == 1:

messagebox.showinfo("Success", "Completed with {} warning".format(warnings))

else:

messagebox.showinfo("Success", "Completed with {} warnings".format(warnings))

else:

print('')

if warnings == 0:

print("Saved to '{}' with no warnings".format(sb2path))

elif warnings == 1:

print("Saved to '{}' with {} warning".format(sb2path, warnings))

else:

print("Saved to '{}' with {} warnings".format(sb2path, warnings))

開發者ID:RexScratch,項目名稱:sb3tosb2,代碼行數:18,

示例3: check_queue

​點贊 6

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def check_queue(self, queue):

if not queue.empty():

item = queue.get()

if item.status == 'done':

messagebox.showinfo(

item.status,

message=item.subject,

detail=item.body

)

self.status.set(item.subject)

return

elif item.status == 'error':

messagebox.showerror(

item.status,

message=item.subject,

detail=item.body

)

self.status.set(item.subject)

return

else:

self.status.set(item.body)

self.after(100, self.check_queue, queue)

開發者ID:PacktPublishing,項目名稱:Python-GUI-Programming-with-Tkinter,代碼行數:24,

示例4: info

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def info(message, title="資訊"):

msgbox.showinfo(title=title, message=message)

開發者ID:winkidney,項目名稱:PickTrue,代碼行數:4,

示例5: info

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def info(subject, text):

messagebox.showinfo(subject, text)

開發者ID:pabloibiza,項目名稱:WiCC,代碼行數:4,

示例6: add_friend

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def add_friend(self, username):

if self.requester.add_friend(self.username, username):

msg.showinfo("Friend Added", "Friend Added")

success = True

self.reload_friends()

else:

msg.showerror("Add Failed", "Friend was not found")

success = False

return success

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:12,

示例7: say_hello

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def say_hello(self):

msgbox.showinfo("Hello", "Hello World!")

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:4,

示例8: say_goodbye

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def say_goodbye(self):

if msgbox.askyesno("Close Window?", "Would you like to close this window?"):

self.label_text.set("Window will close in 2 seconds")

self.after(2000, self.destroy)

else:

msgbox.showinfo("Not Closing", "Great! This window will stay open.")

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:8,

示例9: say_hello

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def say_hello(self):

message = "Hello there " + self.name_entry.get()

msgbox.showinfo("Hello", message)

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:5,

示例10: say_goodbye

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def say_goodbye(self):

self.label_text.set("Window will close in 2 seconds")

msgbox.showinfo("Goodbye!", "Goodbye, it's been fun!")

self.after(2000, self.destroy)

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:6,

示例11: show_about_page

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def show_about_page(self):

msg.showinfo("About", "My text editor, version 2, written in Python3.6 using tkinter!")

開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Programming-by-Example,代碼行數:4,

示例12: filter_help

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def filter_help(self, event=None):

msg = ("Enter a lambda function which returns True if you wish\n"

"to show nodes with ONLY a given property.\n"

"Parameters are:\n"

" - u, the node's name, and \n"

" - d, the data dictionary.\n\n"

"Example: \n"

" d.get('color',None)=='red'\n"

"would show only red nodes.\n"

"Example 2:\n"

" str(u).is_digit()\n"

"would show only nodes which have a numerical name.\n\n"

"Multiple filters are ANDed together.")

tkm.showinfo("Filter Condition", msg)

開發者ID:jsexauer,項目名稱:networkx_viewer,代碼行數:16,

示例13: image_pdf

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def image_pdf(file_dir):

dir_name, base_name = get_dir_name(file_dir)

doc = fitz.Document()

for img in sorted(glob.glob(file_dir + '\\*'), key=os.path.getmtime): # 排序獲得對象

img_doc = fitz.Document(img) # 獲得圖檔對象

pdf_bytes = img_doc.convertToPDF() # 獲得圖檔流對象

img_pdf = fitz.Document("pdf", pdf_bytes) # 将圖檔流建立單個的PDF檔案

doc.insertPDF(img_pdf) # 将單個檔案插入到文檔

img_doc.close()

img_pdf.close()

doc.save(dir_name + os.sep + base_name + ".pdf") # 儲存文檔

doc.close()

messagebox.showinfo('提示', '轉換成功!')

開發者ID:jtyoui,項目名稱:Jtyoui,代碼行數:15,代碼來源:tk.py

示例14: pdf_image

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def pdf_image(pdf_name):

dir_name, base_name = get_dir_name(pdf_name)

pdf = fitz.Document(pdf_name)

for pg in range(0, pdf.pageCount):

page = pdf[pg] # 獲得每一頁的對象

trans = fitz.Matrix(1.0, 1.0).preRotate(0)

pm = page.getPixmap(matrix=trans, alpha=False) # 獲得每一頁的流對象

pm.writePNG(FILE[:-4] + os.sep + base_name[:-4] + '_{:0>4d}.png'.format(pg + 1)) # 儲存圖檔

pdf.close()

messagebox.showinfo('提示', '轉換成功!')

開發者ID:jtyoui,項目名稱:Jtyoui,代碼行數:12,代碼來源:tk.py

示例15: popup

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def popup(title, msg):

root = tk.Tk()

root.withdraw()

messagebox.showinfo(title, msg)

root.quit()

開發者ID:int-brain-lab,項目名稱:ibllib,代碼行數:7,

示例16: register_user

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def register_user(self):

# Check if passwords match

if not self.options['reg_password'].get() == self.options['reg_check_password'].get():

messagebox.showwarning('ERROR', 'Passwords do not match!')

return

else:

pass

# Check if every entry was filled

if self.options['reg_username'].get() == '' or self.options['reg_password'].get() == '' or self.options['reg_name'].get() == '' or self.options['reg_surname'].get() == '' or self.options['reg_email'].get() == '' :

messagebox.showwarning("ERROR", "Not all fields were filled!")

return

else:

pass

# check if username already exists

try:

payload = {'user': self.options['reg_username'].get(), 'pwd': hashlib.sha256(self.options['reg_password'].get().encode('utf-8')).hexdigest(), 'name' : self.options['reg_name'].get(), 'surname' : self.options['reg_surname'].get(), 'email' : self.options['reg_email'].get()}

r = requests.post('https://zeznzo.nl/reg.py', data=payload)

if r.status_code == 200:

if r.text.startswith('[ERROR]'):

messagebox.showwarning('ERROR', r.text.split('[ERROR] ')[1])

return

else:

messagebox.showinfo('INFO', 'User registered!')

else:

messagebox.showwarning('ERROR', 'Failed to register!\n%i' % r.status_code)

return

except Exception as e:

messagebox.showwarning('ERROR', '%s' % e)

return

self.reg.destroy()

開發者ID:leonv024,項目名稱:RAASNet,代碼行數:38,

示例17: delete_me

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def delete_me(self):

return messagebox.showinfo('Cannot do that', 'Please, visit: http://jezsjxtthkqhlqoc.onion/ with Tor browser and login.\n\nYou can delete your profile under the Profile section there.')

開發者ID:leonv024,項目名稱:RAASNet,代碼行數:4,

示例18: compile_decrypt

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def compile_decrypt(self):

try:

decrypt = open(self.options['decryptor_path'].get()).read()

except FileNotFoundError:

return messagebox.showerror('ERROR', 'File does not exist, check decryptor path!')

try:

if self.options['os'].get() == 'windows':

py = 'pyinstaller.exe'

else:

py = 'pyinstaller'

if not 'from tkinter.ttk import' in decrypt:

tk = ''

else:

tk = '--hidden-import tkinter --hiddenimport tkinter.ttk --hidden-import io'

if not 'from Crypto import Random' in decrypt:

crypto = ''

else:

crypto = '--hidden-import pycryptodome'

if not 'import pyaes' in decrypt:

pyaes = ''

else:

pyaes = '--hidden-import pyaes'

if not 'from pymsgbox':

pymsg = ''

else:

pymsg = '--hidden-import pymsgbox'

os.system('%s -F -w %s %s %s %s %s' % (py, tk, crypto, pyaes, pymsg, self.options['decryptor_path'].get()))

messagebox.showinfo('SUCCESS', 'Compiled successfully!\nFile located in: dist/\n\nHappy Hacking!')

self.comp.destroy()

except Exception as e:

messagebox.showwarning('ERROR', 'Failed to compile!\n\n%s' % e)

開發者ID:leonv024,項目名稱:RAASNet,代碼行數:41,

示例19: view_license

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def view_license(self):

messagebox.showinfo('License', 'Software: Free (Public Test)\nLicense: GNU General Public License v3.0')

開發者ID:leonv024,項目名稱:RAASNet,代碼行數:4,

示例20: show_dialog

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def show_dialog(self, text):

messagebox.showinfo('Info', text)

開發者ID:llSourcell,項目名稱:Introduction_Move37,代碼行數:4,代碼來源:ui.py

示例21: help

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def help(self, event=None):

paras = [

"""{} is a basic plain text editor (using the UTF-8 encoding).""".format(

APPNAME),

"""The purpose is really to show how to create a standard

main-window-style application with menus, toolbars, etc.,

as well as showing basic use of the Text widget.""",

]

messagebox.showinfo("{} — {}".format(HELP, APPNAME),

"\n\n".join([para.replace("\n", " ") for para in paras]),

parent=self)

開發者ID:lovexiaov,項目名稱:python-in-practice,代碼行數:13,

示例22: _check_game_over

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def _check_game_over(self):

userWon, canMove = self._check_tiles()

title = message = None

if userWon:

title, message = self._user_won()

elif not canMove:

title = "Game Over"

message = "Game over with a score of {:,}.".format(

self.score)

if title is not None:

messagebox.showinfo("{} — {}".format(title, APPNAME), message,

parent=self)

self.new_game()

else:

self.update_score()

開發者ID:lovexiaov,項目名稱:python-in-practice,代碼行數:17,

示例23: help

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def help(self, event=None):

paras = [

"""Reads all the images in the source directory and produces smoothly

scaled copies in the target directory."""]

messagebox.showinfo("Help — {}".format(APPNAME),

"\n\n".join([para.replace("\n", " ") for para in paras]),

parent=self)

開發者ID:lovexiaov,項目名稱:python-in-practice,代碼行數:9,

示例24: help

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def help(self, event=None):

paras = [

"""{} is a basic plain text editor (using the UTF-8 encoding).""".format(

APPNAME),

"""The purpose is really to show how to create a standard

main-window-style application with menus, toolbars, dock windows, etc.,

as well as showing basic use of the Text widget.""",

]

messagebox.showinfo("{} — {}".format(HELP, APPNAME),

"\n\n".join([para.replace("\n", " ") for para in paras]),

parent=self)

開發者ID:lovexiaov,項目名稱:python-in-practice,代碼行數:13,

示例25: savebarcode

​點贊 5

# 需要導入子產品: from tkinter import messagebox [as 别名]

# 或者: from tkinter.messagebox import showinfo [as 别名]

def savebarcode(self, bcodevalue, autoname=False):

savestate = False

fname = ""

if autoname:

fname = self.filedir + '/' + bcodevalue + '.' + self.filetype.lower()

else:

fname = fdial.asksaveasfilename(

defaultextension='png',

parent=self.master,

title='Saving barcode',

filetypes=[

('PNG',

'*.png'),

('JPEG',

'*.jpg *.jpeg'),

('GIF',

'*.gif'),

('Adobe PDF',

'*.pdf'),

('Barcha fayllar',

'*.*')])

if(fname):

tmpbarcode = self.generatebarcode(bcodevalue)

tmpbarcode.filename = fname

savestate = tmpbarcode.validate_create_barcode()

if(not savestate):

mbox.showerror("Warning", "Barcode saving error")

else:

mbox.showinfo("Info", "Barcode is saved as file successfully")

開發者ID:bzimor,項目名稱:Barcode-generator,代碼行數:31,

注:本文中的tkinter.messagebox.showinfo方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路程式設計大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。