欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

python彈框二之tkinter.messagebox

系統 2121 0

? ? ? ? 前面寫過python彈框的ctypes.windll.user32方法:https://blog.csdn.net/Gordennizaicunzai/article/details/78966694

該方法調用windows系統的user32組件,不是純python方法,且wser32的MessageBoxA使用不當會出現亂碼,不是很好用。這里介紹pythonic的彈框——tkinter.messagebox。

NAME
? ? tkinter.messagebox

DESCRIPTION
? ? # tk common message boxes
? ? #
? ? # this module provides an interface to the native message boxes
? ? # available in Tk 4.2 and newer.
? ? #
? ? # written by Fredrik Lundh, May 1997
? ? #

CLASSES
? ? tkinter.commondialog.Dialog(builtins.object)
? ? ? ? Message
? ??
? ? class Message(tkinter.commondialog.Dialog)
? ? ?| ?Message(master=None, **options)
? ? ?| ?
? ? ?| ?A message box
? ? ?| ?
? ? ?| ?Method resolution order:
? ? ?| ? ? ?Message
? ? ?| ? ? ?tkinter.commondialog.Dialog
? ? ?| ? ? ?builtins.object
? ? ?| ?
? ? ?| ?Data and other attributes defined here:
? ? ?| ?
? ? ?| ?command = 'tk_messageBox'
? ? ?| ?
? ? ?| ?----------------------------------------------------------------------
? ? ?| ?Methods inherited from tkinter.commondialog.Dialog:
? ? ?| ?
? ? ?| ?__init__(self, master=None, **options)
? ? ?| ? ? ?Initialize self. ?See help(type(self)) for accurate signature.
? ? ?| ?
? ? ?| ?show(self, **options)
? ? ?| ?
? ? ?| ?----------------------------------------------------------------------
? ? ?| ?Data descriptors inherited from tkinter.commondialog.Dialog:
? ? ?| ?
? ? ?| ?__dict__
? ? ?| ? ? ?dictionary for instance variables (if defined)
? ? ?| ?
? ? ?| ?__weakref__
? ? ?| ? ? ?list of weak references to the object (if defined)

FUNCTIONS

showinfo(title=None, message=None, **options)
? ? ? ? Show an info message

注意,tkinter.messagebox默認主窗口是顯示狀態,我們彈框時它是多于的,需要隱藏。

            
              >>> import tkinter as tk
>>> from tkinter import messagebox as messagebox
>>> 
>>> messagebox.showinfo('彈框', '注意,主窗口未退出')
'ok'
>>> 
            
          

python彈框二之tkinter.messagebox_第1張圖片 ? ?

隱藏主窗口,函數要放在彈框前,否則無效:

showerror(title=None, message=None, **options)
? ? ? ? Show an error message

            
              >>> tk.Tk().withdraw()  # 隱藏主窗口
''
>>> messagebox.showerror('彈框', 'say something')
'ok'
>>> 
            
          


? ?? python彈框二之tkinter.messagebox_第2張圖片

? ??
? ? showwarning(title=None, message=None, **options)
? ? ? ? Show a warning message

            
              >>> tk.Tk().deiconify()  # 顯示主窗口
''
>>> messagebox.showwarning('彈框', 'say something')
'ok'
>>> 
            
          

python彈框二之tkinter.messagebox_第3張圖片

askokcancel(title=None, message=None, **options)
? ? ? ? Ask if operation should proceed; return true if the answer is ok


? ? ? ? 選擇確定/取消,返回值分別對應true/false,下同:

            
              >>> 
>>> tk.Tk().withdraw()  # 隱藏主窗口
''
>>> msg = messagebox.askokcancel('對話框', '請選擇')
>>> msg
False
>>> 
            
          

python彈框二之tkinter.messagebox_第4張圖片
? ? askquestion(title=None, message=None, **options)
? ? ? ? Ask a question

            
              >>> 
>>> msg = messagebox.askquestion('對話框', '請選擇')
>>> 
            
          

python彈框二之tkinter.messagebox_第5張圖片
? ??
? ? askretrycancel(title=None, message=None, **options)
? ? ? ? Ask if operation should be retried; return true if the answer is yes

            
              msg = messagebox.askretrycancel('對話框', '請選擇')
            
          


? ?? python彈框二之tkinter.messagebox_第6張圖片
? ? askyesno(title=None, message=None, **options)
? ? ? ? Ask a question; return true if the answer is yes
? ??

            
               msg = messagebox.askyesno('對話框', '請選擇')
            
          

python彈框二之tkinter.messagebox_第7張圖片
? ? askyesnocancel(title=None, message=None, **options)
? ? ? ? Ask a question; return true if the answer is yes, None if cancelled.

            
              >>> msg = messagebox.askyesnocancel('對話框', '請選擇')
>>> msg
True
>>> msg = messagebox.askyesnocancel('對話框', '請選擇')
>>> msg
False
>>> msg = messagebox.askyesnocancel('對話框', '請選擇')
>>> msg
>>> 
            
          


? ?? python彈框二之tkinter.messagebox_第8張圖片

DATA
? ? ABORT = 'abort'
? ? ABORTRETRYIGNORE = 'abortretryignore'
? ? CANCEL = 'cancel'
? ? ERROR = 'error'
? ? IGNORE = 'ignore'
? ? INFO = 'info'
? ? NO = 'no'
? ? OK = 'ok'
? ? OKCANCEL = 'okcancel'
? ? QUESTION = 'question'
? ? RETRY = 'retry'
? ? RETRYCANCEL = 'retrycancel'
? ? WARNING = 'warning'
? ? YES = 'yes'
? ? YESNO = 'yesno'
? ? YESNOCANCEL = 'yesnocancel'


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 亚洲国产精品欧美综合 | 欧美精品中文字幕久久二区 | 成人久久精品一区二区三区 | 久久久黄色 | 国产在线精品成人一区二区三区 | 久久久国产精品免费观看 | 国产亚洲精品久久久久久无码网站 | 五月天色婷婷综合 | 午夜丁香婷婷 | 亚洲网站免费观看 | 99热在这里只有精品 | 999热精品| 成人性视频免费网站 | 日韩在线你懂的 | 欧美激情视频网站 | 亚洲精品在线视频 | 香蕉视频在线观看免费国产婷婷 | 黄色小视频在线观看 | 亚洲精品一区在线观看 | 亚洲成a人片在线观看www流畅 | 日韩欧美一区二区三区免费观看 | 91福利影院| 欧洲一级视频 | 亚州天堂网 | 亚洲三级视频在线观看 | 国产精品视屏 | 91免费在线 | 国产成人av在线 | 欧美成人精品一区二区三区 | 香港三级台湾三级在线播放徐 | 99久久久久久| 波多野结衣在线网站 | 亚洲免费在线看 | 2022国产成人精品福利网站 | 亚洲欧美日韩精品久久奇米色影视 | 亚洲五月综合网色九月色 | 国产欧美精品午夜在线播放 | 一区二区免费 | 亚洲精品国产电影 | 可米影院 | 国产午夜精品福利视频 |