def genTeachReport(self):
'''
Creates a CSV file with name, loginID, and group scores for each student in
app_data fullGBook. Headers are included.
'''
csvOut = []
heads = ['name','login_ID',]
for i in self.app_data['fullGBook'][0]['results']:
heads.append(i['title'])
for i in self.app_data['fullGBook']:
toAdd = []
toAdd.append(i['name'])
toAdd.append(i['login_id'])
for k in i['results']:
for j in heads:
if j == k['title']:
toAdd.append(k['mean'])
csvOut.append(toAdd)
with open('StandardsReport.csv', 'w', newline='') as csvfile:
writeOut = csv.writer(csvfile, delimiter=',',dialect='excel')
writeOut.writerow(heads)
for i in csvOut:
writeOut.writerow(i)
messagebox.showinfo(title='Export', message='Data exported to CSV')
python类showinfo()的实例源码
def uploder(self):
code = self.lfc_field_1_t.get('0.0', 'end')
code = code.encode(encoding="utf-8")
code = base64.urlsafe_b64encode(code)
url = "http://" + HOST + ":" + PORT + "/postcode?code=" + str(code)
try:
req = requests.get(url)
if req.text == "200":
messagebox.showinfo("??", "????")
# ?????
self.lfc_field_1_t.delete('0.0', 'end')
else:
messagebox.showinfo("??", "????????")
except:
messagebox.showinfo("??", "????????")
# ???? ?base64????
def upfile(self):
url = "http://" + HOST + ":" + PORT + "/upfile"
# ???????
filename = filedialog.askopenfilename()
self.lfc_field_1_t.delete('0.0', 'end')
self.lfc_field_1_t.insert('0.0', "??????......")
try:
files = {'file': open(str(filename), 'rb')}
req = requests.post(url, files=files)
if req.status_code == 200:
messagebox.showinfo("??", "????")
else:
messagebox.showinfo("??", "????????")
except:
messagebox.showinfo("??", "????????")
finally:
self.lfc_field_1_t.delete('0.0', 'end')
# ????
def downfile(self):
try:
# ??????????????_???????????
filename = filedialog.asksaveasfilename()
self.lfc_field_1_t.delete('0.0', 'end')
self.lfc_field_1_t.insert('0.0', "??????......\n")
filename = filename + '.' + \
requests.get("http://" + HOST + ":" +
PORT + "/downfiletype").text
self.lfc_field_1_t.insert('0.0', "?????????......")
req = requests.get("http://" + HOST + ":" + PORT + "/downfile")
if req.status_code == 200:
with open(filename, 'wb') as savefile:
savefile.write(req.content)
messagebox.showinfo("??", "????")
else:
messagebox.showinfo("??", "????????")
except:
messagebox.showinfo("??", "????????")
finally:
self.lfc_field_1_t.delete('0.0', 'end')
def scan(self):
self.txt.delete(0.0, END)
self.txt.insert(0.0, ('Scanning ' + self.srvr.get() + ' ... \n'))
#The beginning of PSresult.txt
port_file = open("PSresult.txt", "w")
port_file.write("\n##Scanned " + self.srvr.get() + ': ##\n')
#Beginning of the for loop:
for port in range(int(self.start.get()), int(self.end.get()) + 1):
if self.pscan(port):
msg = "Port " + str(port) + ' Is open \n'
self.txt.insert(float(port) + 1, msg)
port_file.write(msg)
else:
self.txt.insert(float(port) + 1, 'Port ' + str(port) + ' is closed! \n')
msg = "Port " + str(port) + ' Is closed \n'
port_file.write(msg)
port_file.close()
messagebox.showinfo(title='Cissa Port Scanner', message='Your Scan is finished. Happy Hacking :)')
def hello(self):
name = self.nameInput.get() or 'world'
messagebox.showinfo('Message', 'Hello, %s' %name)
def infoBox(self, title, message):
self.topLevel.update_idletasks()
MessageBox.showinfo(title, message)
self.__bringToFront()
def __init__(self, response=str, text="", title=None, accept=0, **options):
if response is bool:
self.dialog = [askyesno, askokcancel, askretrycancel][accept]
else: self.dialog = {None:showinfo, str:askstring, int:askinteger, float:askfloat,
0:askopenfilename, 1:asksaveasfilename, 2:askdirectory}[response]
self.options = options.copy()
if "initialdir" in options:
self.options["initialdir"] = abspath(options["initialdir"])
if type(response) is int:
self.args = tuple()
if title: self.options["title"] = title
else:
if title is None:
title = "Info" if response is None else "Confirm" if response is bool else "Input"
self.args = title, text
def show_result():
messagebox.showinfo("calcylator",str("game over"))
def quitProgram():
tkMessageBox.showinfo(productName, coremeraco.constructExitStatement())
if sound:
sound.stop()
sys.exit() # Just running exit() doesn't work with PyInstaller
def infoBox(self, title, message):
self.topLevel.update_idletasks()
MessageBox.showinfo(title, message)
self.__bringToFront()
def anunciar_ganador(self, data):
messagebox.showinfo("¡Atención!", message=data)
# Handle Events
def hello(self):
name = self.nameInput.get() or 'world'
messagebox.showinfo('Message', 'Hello, %s!' % name)
GUI_const_42.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 24
收藏 0
点赞 0
评论 0
def _msgBox():
msg.showinfo('Python Message Info Box', 'A Python GUI created using tkinter:\nThe year is 2017.')
# Add another Menu to the Menu Bar and an item
GUI_const_42_777_global_print.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 20
收藏 0
点赞 0
评论 0
def _msgBox():
msg.showinfo('Python Message Info Box', 'A Python GUI created using tkinter:\nThe year is 2017.')
# Add another Menu to the Menu Bar and an item
GUI_const_42_print_func.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 15
收藏 0
点赞 0
评论 0
def _msgBox():
msg.showinfo('Python Message Info Box', 'A Python GUI created using tkinter:\nThe year is 2017.')
# Add another Menu to the Menu Bar and an item
GUI_data_from_widget.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 18
收藏 0
点赞 0
评论 0
def _msgBox():
msg.showinfo('Python Message Info Box', 'A Python GUI created using tkinter:\nThe year is 2017.')
# Add another Menu to the Menu Bar and an item
GUI_const_42_print.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 17
收藏 0
点赞 0
评论 0
def _msgBox():
msg.showinfo('Python Message Info Box', 'A Python GUI created using tkinter:\nThe year is 2017.')
# Add another Menu to the Menu Bar and an item
GUI_const_42_777_global.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 18
收藏 0
点赞 0
评论 0
def _msgBox():
msg.showinfo('Python Message Info Box', 'A Python GUI created using tkinter:\nThe year is 2017.')
# Add another Menu to the Menu Bar and an item