Detailed explanation of MessageBox pop-up window of Tkinter Library in Python

Time:2022-5-4

“The ancients’ knowledge is weak, but their Kung Fu can only be achieved when they are young and old.”

Python Tkinter library pop-up message box,It’s not easy to code words, but it’s more difficult to produce high-quality products. If you’re not particularly lucky, please make special efforts first. Don’t fail because of laziness, and hypocritically attribute the reason to your own bad luck. You have to work very hard to appear effortless. If this article can bring you some help, I hope to give little brother flying rabbit one key three times to express support. Thank you, little friends.

Tkinter is Python’s own graphical interface library, which contains many graphical interface controls, including label label, button button, RadioButton radio box, checkbutton check box, entry text box, etc. With the help of various graphical interface controls in Tkinter library, we can design practical graphical interface programs.

1、 Message prompt box

import tkinter.messagebox as msgbox
 
msgbox. Showinfo ('warm tips', 'congratulations on winning ~')

2、 Message warning box

import tkinter.messagebox as msgbox
 
msgbox. Showwarning ('operation warning ',' this operation is risky ')

3、 Error message box

import tkinter.messagebox as msgbox
 
msgbox. Showerror ('error prompt ',' network error ')

4、 The dialog box cannot be closed

import tkinter.messagebox as msgbox
 
msgbox. Askquestion ('confirm operation ',' are you sure to execute this operation? '# return value yes / no
 
msgbox. Askyesno ('confirm operation ',' confirm execution? '# return value true / false

5、 You can close the dialog box

import tkinter.messagebox as msgbox
 
msgbox. Askokcancel ('confirm operation ',' this operation needs to be cautious ~ ') # returns the value true / false
 
msgbox. Askretrycancel ('confirm operation ',' if the operation cannot be undone ~ '# returns the value true / false

The above is the details of Python’s Tkinter library pop-up MessageBox. For more information about Python pop-up MessageBox, please pay attention to other relevant articles of developeppaer!

Recommended Today

SQL server cannot generate fruncm thread

SQL Server was unable to generate the fruncm thread. The database error log is as follows: Copy codeThe code is as follows: 2013-09-26 21:21:50.31 Server      Microsoft SQL Server 2005 – 9.00.1399.06 (Intel X86)Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft CorporationEnterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 2) 2013-09-26 21:21:50.31 Server      (c) […]