Python advanced 8-customize a message prompt box with Tkinter

Time:2020-3-8

Tkinter is a GUI module of python, which contains all kinds of window controls, in which messagbox can be used to make all kinds of information pop-up windows.

Here is the code for making the information prompt box:

import tkinter as tk
import tkinter.messagebox

def show_warning(msg):    
    Tk.messagebox.showwarning ("prompt", MSG)

if __name__ == '__main__':    
    Show_warning ('This is an example of information prompt ')

Python advanced 8-customize a message prompt box with Tkinter

There is a problem in this code, that is, there is a TK background window accompanying the display, which needs to be adjusted.

Here is the adjusted Code:

import tkinter as tk
import tkinter.messagebox

def show_warning(msg):    
    top = tkinter.Tk()    
    top.withdraw()    
    top.update()    
    Tk.messagebox.showwarning ("prompt", MSG)    
    top.destroy()

if __name__ == '__main__':    
    Show_warning ('This is an example of information prompt ')

Python advanced 8-customize a message prompt box with Tkinter

Recommended Today

NOR flash memory begins the development of automobile field

As cars become more intelligent and require more storage space, many technologies are struggling for the driver’s seat, but it is certain that the NOR flash can at least use a shot gun.With its programmable ability, nor flash exists in many applicationsEEPROMIt has found new opportunities in applications that require fast, nonvolatile memory, including communications, […]