Edit detail for tkMessageBoxExample revision 1 of 1

1
Editor: danr
Time: 2006/09/05 14:09:10 GMT+0
Note: Created tkMessageBox example entry

changed:
-
# tkMessageBox example code by Dan Rahmel
# I had a difficult time finding example code showing how to use the Tkinter Messagebox functions. 
# After I figured it out, I put together this brief sample. 

import leoGlobals as g 
import leoPlugins 
 
import tkMessageBox 
 
# Messageboxes for questions
answer = tkMessageBox.askyesno("askyesno", "Hello from askyesno\n1 of 7")
# Change default button. Can be ABORT, RETRY, IGNORE, OK, CANCEL, YES, NO
answer = tkMessageBox.askquestion(title="askquestion", message="Hello from askquestion\n2 of 7", fault=tkMessageBox.NO) 
answer = tkMessageBox.askokcancel("askokcancel", "Hello from askokcancel\n3 of 7") 
answer = tkMessageBox.askretrycancel("askretrycancel", "Hello from askretrycancel\n4 of 7") 
 
# Messageboxes for info 
answer = tkMessageBox.showinfo("showinfo", "Hello from showinfo\n5 of 7") 
answer = tkMessageBox.showerror("showerror", "Hello from showerror\n6 of 7") 
warningMsg = "showwarning" 
answer = tkMessageBox.showwarning("showwarning","Final hello from:\n(%s)\n7 of 7" % warningMsg) 


# tkMessageBox example code by Dan Rahmel # I had a difficult time finding example code showing how to use the Tkinter Messagebox functions. # After I figured it out, I put together this brief sample.

import leoGlobals as g import leoPlugins

import tkMessageBox

# Messageboxes for questions answer = tkMessageBox.askyesno("askyesno", "Hello from askyesnon1 of 7") # Change default button. Can be ABORT, RETRY, IGNORE, OK, CANCEL, YES, NO answer = tkMessageBox.askquestion(title="askquestion", message="Hello from askquestionn2 of 7", fault=tkMessageBox.NO) answer = tkMessageBox.askokcancel("askokcancel", "Hello from askokcanceln3 of 7") answer = tkMessageBox.askretrycancel("askretrycancel", "Hello from askretrycanceln4 of 7")

# Messageboxes for info answer = tkMessageBox.showinfo("showinfo", "Hello from showinfon5 of 7") answer = tkMessageBox.showerror("showerror", "Hello from showerrorn6 of 7") warningMsg = "showwarning" answer = tkMessageBox.showwarning("showwarning","Final hello from:n(%s)n7 of 7" % warningMsg)