def onPrint():
MB.showinfo('FYI','Make sure your printer is turned on and ready!\nThen press OK ;-)\n\nTested with hp f340')
l = [(canvas.type(obj),canvas.coords(obj)) for obj in canvas.find_all()]
print l
print_canvas(l)
python类showinfo()的实例源码
def main(key):
'Delete key and all empty parent keys.'
Tkinter.Tk().withdraw()
try:
key, parent = delete(*key.rsplit('\\', 1))
while empty(parent):
key, parent = delete(*key.rsplit('\\', 1))
tkMessageBox.showinfo('Info', 'Uninstall passed!')
except:
tkMessageBox.showerror('Error', traceback.format_exc())
def quitProgram():
tkMessageBox.showinfo(productName, coremeraco.constructExitStatement())
if sound:
sound.stop()
sys.exit() # Just running exit() doesn't work with PyInstaller
def apply(self):
# this is where we write out the config file to disk
self.settings.write()
tkMessageBox.showinfo("Restart PyKeylogger", "You must restart PyKeylogger for the new settings to take effect.")
def infoBox(self, title, message):
self.topLevel.update_idletasks()
MessageBox.showinfo(title, message)
self.__bringToFront()
def pass_alert():
tkMessageBox.showinfo("Password Alert","Please enter a password.")
def enc_success(imagename):
tkMessageBox.showinfo("Success","Encrypted Image: " + imagename)
def anunciar_ganador(self, data):
messagebox.showinfo("¡Atención!", message=data)
# Handle Events
def MsgBox(title, text, style):
box = [
msg.showinfo, msg.showwarning, msg.showerror,
msg.askquestion, msg.askyesno, msg.askokcancel, msg.askretrycancel,
];
tk.Tk().withdraw(); #Hide Main Window.
if style in range(7):
return box[style](title, text)
def MsgBox(title, text, style):
box = [
msg.showinfo, msg.showwarning, msg.showerror,
msg.askquestion, msg.askyesno, msg.askokcancel, msg.askretrycancel,
];
tk.Tk().withdraw(); #Hide Main Window.
if style in range(7):
return box[style](title, text)
def click_change_city(current_city, city_name, window):
global curr_weather
for city in weather.city_list:
if city[2].decode('utf8') == city_name:
current_city.set(city_name)
curr_weather = weather.query_city(city_name)
update_weather()
window.destroy()
return
tkMessageBox.showinfo('??', '???????')
def showHelp(self):
helpstr=dgbk('''\n\n
?????\n
1. ??/pad????\n
1?û?itunesapp???š???š??iDoc?\n
2?û????ting??\n
2. ximaexport-gui.exe\n
ting.sqlite???1?? ting.sqlite. ?\n
???????á\n
???????All\n
??
''')
tkMessageBox.showinfo(title='Help', message=helpstr)
#print(self.menfolder.get())
def add_friend():
def send_message():
msgcontent = '?:'+ time.strftime("%Y-%m-%d %H:%M:%S",time.localtime()) + '\n '
text_msglist_child.insert(END, msgcontent, 'green')
text_msglist_child.insert(END, text_msg_child.get('0.0', END))
data=text_msg_child.get('0.0', END)
text_msg_child.delete('0.0', END)
data2='03#'+temp+'#'+data+'#'
ADDR = ('202.114.196.97', 11560)
udpCliSock.sendto(data2.encode('utf-8'), ADDR)
data3, ADDR = udpCliSock.recvfrom(1024)
text_msglist_child.insert(END,'????'+data3+'\n')
temp=friend_account.get()
if temp=='':
tkMessageBox.showinfo('??','??????????')
return
friend_account.set('')
#???
child=Toplevel()
child.title(temp)
frame_left_top = Frame(child,width=380, height=270, bg='white')
frame_left_center = Frame(child,width=380, height=50, bg='white')
frame_left_top.grid(row=0, column=0, padx=2, pady=5)
frame_left_center.grid(row=1, column=0, padx=2, pady=5)
frame_left_top.grid_propagate(0)
frame_left_center.grid_propagate(0)
text_msglist_child= Text(frame_left_top)
text_msg_child= Text(frame_left_center)
text_msglist_child.grid()
text_msg_child.grid()
Button(child, text='??',command=send_message).grid(row=2,column=0,sticky=W)
def Register():
def onsure():
data='01#'+top_account.get()+'#'+top_password.get()+'#'+pass_word_sure.get()+'#'
ADDR = ('202.114.196.97',11560)
udpCliSock.sendto(data, ADDR)
data, ADDR = udpCliSock.recvfrom(1024)
if data=='01:01':
tkMessageBox.showinfo('??','?????')
elif data=='01:02':
tkMessageBox.showinfo('????','???????')
elif data=='01:03':
tkMessageBox.showinfo('????','??????')
else:
tkMessageBox.showinfo('????','??????')
top.destroy()
#???
top=Toplevel()
top.title('????')
#??????
top_account=StringVar()
top_password=StringVar()
Label(top,text='???',width=8).grid(row=0,column=0)
Entry(top,textvariable=top_account).grid(row=0,column=1)
Label(top,text='???',width=8).grid(row=1,column=0)
Entry(top,textvariable=top_password,show='*').grid(row=1,column=1)
Label(top,text='?????',width=8).grid(row=2,column=0)
pass_word_sure=StringVar()
Entry(top,textvariable=pass_word_sure,show='*').grid(row=2,column=1)
Button(top,text='????',width=8,command=onsure).grid(row=3)
#??
def Login():
if cin_account.get()=='' or cin_password.get()=='':
tkMessageBox.showinfo('??','?????????')
return
data='02#'+cin_account.get()+'#'+cin_password.get()+'#'
ADDR = ('202.114.196.97',11560)
udpCliSock.sendto(data, ADDR)
data, ADDR = udpCliSock.recvfrom(1024)
if data=='02:01':
tkMessageBox.showinfo('??','?????')
root.destroy()
root2=Tk()
root2.title('QQ???')
frame_left_top = Frame(root2,width=300, height=200, bg='white')
frame_left_top.grid(row=0, column=0, padx=2, pady=5)
frame_left_top.grid_propagate(0)
global text_msglist
text_msglist = Text(frame_left_top)
text_msglist.grid()
Label(root2,text='???',width=8).grid(row=1,column=0)
global friend_account
friend_account=StringVar()
Entry(root2,textvariable=friend_account).grid(row=2,column=0)
Button(root2, text='????',command=add_friend).grid(row=3,column=0)
#????
thread.start_new_thread(send,())
elif data=='02:02':
tkMessageBox.showinfo('????','?????')
elif data=='02:03':
tkMessageBox.showinfo('????','??????')
elif data=='02:04':
tkMessageBox.showinfo('??','??????')
#???????????
temp='06#'
udpCliSock.sendto(temp, ADDR)
data2, ADDR = udpCliSock.recvfrom(1024)
if data2=='06:01':
tkMessageBox.showinfo('??','?????')
else:
tkMessageBox.showinfo('??','???????')
def Register():
def onsure():
data='01#'+top_account.get()+'#'+top_password.get()+'#'+pass_word_sure.get()+'#'
#ADDR=("localhost",11567)
ADDR = ('202.114.196.97',11560)
udpCliSock.sendto(data, ADDR)
data, ADDR = udpCliSock.recvfrom(1024)
#udpCliSock.close()
if data=='01:01':
tkMessageBox.showinfo('??','?????')
elif data=='01:02':
tkMessageBox.showinfo('????','???????')
elif data=='01:03':
tkMessageBox.showinfo('????','??????')
else:
tkMessageBox.showinfo('????','??????')
top.destroy()
#???
top=Toplevel()
top.title('????')
Label(top,text='???',width=8).grid(row=0,column=0)
Entry(top,textvariable=top_account).grid(row=0,column=1)
Label(top,text='???',width=8).grid(row=1,column=0)
Entry(top,textvariable=top_password,show='*').grid(row=1,column=1)
Label(top,text='?????',width=8).grid(row=2,column=0)
pass_word_sure=StringVar()
Entry(top,textvariable=pass_word_sure,show='*').grid(row=2,column=1)
Button(top,text='????',width=8,command=onsure).grid(row=3)
#??
def Login():
if cin_account.get()=='' or cin_password.get()=='':
tkMessageBox.showinfo('??','?????????')
return
data='02#'+cin_account.get()+'#'+cin_password.get()+'#'
#udpCliSock = socket(AF_INET, SOCK_DGRAM)
ADDR = ('202.114.196.97',11560)
udpCliSock.sendto(data, ADDR)
data, ADDR = udpCliSock.recvfrom(1024)
if data=='02:01':
tkMessageBox.showinfo('??','?????')
#udpCliSock.close()
main(udpCliSock)
root.destroy()
elif data=='02:02':
tkMessageBox.showinfo('????','?????')
elif data=='02:03':
tkMessageBox.showinfo('????','??????')
elif data=='02:04':
tkMessageBox.showinfo('??','??????')
#???????????
temp='06#'
udpCliSock.sendto(temp, ADDR)
data2, ADDR = udpCliSock.recvfrom(1024)
if data2=='06:01':
tkMessageBox.showinfo('??','?????')
else:
tkMessageBox.showinfo('??','???????')
#udpCliSock.close()
#????????
#grid:?????????
def show_info(self, title, message):
return messagebox.showinfo(title, message)
def show_info(self, title, message):
return messagebox.showinfo(title, message)
def HistoryParser():
tkMessageBox.showinfo("", "History Parser")
Histclass.HistParser()