Python's tkinter Use-message bullet box

Source: Internet
Author: User

1 #MessageBox: Message Bullet box2 #constantly click the button to toggle various pop-up windows3 ImportTkinter as TK4  fromTkinterImportMessageBox5  fromTk_center_winImportSet_win_center6 7Root =tk. Tk ()8Root.title ('message Box')9Root.geometry ('190x80+300+300')#Setting the window size and positionTen #Set_win_center (Root, 190, 80) # Set the window size and center the display Onen =0 AStr_var =tk. Stringvar () -Str_var.set ('Askokcancel') -  the  - defcmd (): -     " "Bullet Box Tips" " -     GlobalN +     GlobalStr_var -n + = 1 +     ifn = = 1: AR = Messagebox.askokcancel ('message Box','Askokcancel') at         Print('Askokcancel:', R) -Str_var.set ('askquestion') -     elifn = = 2: -R = Messagebox.askquestion ('message Box','askquestion') -         Print('askquestion:', R) -Str_var.set ('AskYesNo') in     elifn = = 3: -R = Messagebox.askyesno ('message Box','AskYesNo') to         Print('AskYesNo:', R) +Str_var.set ('Askretrycancel') -     elifn = = 4: theR = Messagebox.askretrycancel ('message Box','Askretrycancel') *         Print('Askretrycancel:', R) $Str_var.set ('ShowError')Panax Notoginseng     elifn = = 5: -R = Messagebox.showerror ('message Box','ShowError') the         Print('ShowError:', R) +Str_var.set ('Showinfo') A     elifn = = 6: theR = Messagebox.showinfo ('message Box','Showinfo') +         Print('Showinfo:', R) -Str_var.set ('showwarning') $     Else: $R = messagebox.showwarning ('message Box','showwarning') -         Print('showwarning:', R) -Str_var.set ('Askokcancel') then =0 - Wuyi  thelabel = Tk. Label (Root, text='constantly click the button to toggle various pop-up windows', font='Song Body -14', pady=8) - Label.grid () Wubtn = Tk. Button (Root, width=' the', Textvariable=str_var, command=cmd) - Btn.grid () About  $Root.mainloop ()

Python's tkinter Use-message bullet box

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.