def main(): retention_csv = 'data/retention_pc.csv' compat_matrix, products, df = create_complete_data(retention_csv) app = QApplication(sys.argv) view = AppView(products=products) view.show() model = AppModel(compat_matrix, products) AppController(view=view, model=model) sys.exit(app.exec_())
def main(): root = tk.Tk() root.title("OhnO game") root.resizable(0, 0) # get screen width and height ws = root.winfo_screenwidth() # width of the screen hs = root.winfo_screenheight() # height of the screen root.withdraw() answer = simpledialog.askinteger("Input", "Enter length of matrix (3-23)", parent=root, minvalue=3, maxvalue=23, initialvalue=5) if (answer != None): root.deiconify() appModel = AppModel(answer) appModel.scramble() app = Application(appModel, root) app.mainloop()
from flask import Flask, render_template, flash, redirect, url_for, session, logging, request from functools import wraps import requests from model import AppModel from view_header import Route from presenter import Presenter from form import ArticleForm, RegisterForm from newsapi import News, NEWS_SRC app = Flask(__name__) model = AppModel(app) presenter = Presenter(model) def create_template(route): route_name = route.get_name() if route.is_redirect(): return redirect(url_for(route_name)) else: route_arg = route.get_args() if (route_arg == None): return render_template(route_name) return render_template(route_name, **(route_arg)) def present_flash(f): if (not (f == None)): flash(f.get_msg(), f.get_msg_type().value)
from threading import Timer from flask import Flask, Response, request, render_template, jsonify, send_from_directory, send_file from werkzeug.utils import secure_filename app = Flask(__name__) app.debug = True APP_ROOT = os.path.dirname(os.path.abspath(__file__)) UPLOAD_FOLD_NAME = "uploads" OUTPUT_FOLD_NAME = "output" app.config['UPLOAD_FOLDER'] = os.path.join(APP_ROOT, UPLOAD_FOLD_NAME) app.config['OUTPUT_FOLDER'] = os.path.join(APP_ROOT, OUTPUT_FOLD_NAME) #appmodel will keep track of application state. appmodel = AppModel() # pop open your favorite browser when the app is run. def open_browser(): webbrowser.open_new('http://localhost:5000/') Timer(1, open_browser).start() def open_file(filename): #if the file is the same, all clear if filename == appmodel.open_file_name: file = appmodel.open_file
from model import AppModel model = AppModel() print(model.fetchall()) value = ('CS410', 'spring 2018', '1:00~2:00', 'me', '5/5', '2/5', 'very good') model.insert_course(value) print(model.fetchall()) model.update_difficulty('200', 1) print(model.fetchall())
# Text can also be a sequence of strings, in which case this method # will return a sequence of results for each text. result = translate_client.translate(text, target_language=target) return result['translatedText'] #print(u'Text: {}'.format(result['input'])) #print(u'Translation: {}'.format(result['translatedText'])) #print(u'Detected source language: {}'.format( #result['detectedSourceLanguage'])) # [END translate_translate_text] #---------------- End of Google Tranlate API ---------------- app = Flask(__name__) model = AppModel() trans_model = AppModel() #conent translated in Chinese value1 = ( 'CS410 Web Security', 'Winter 2018', 'TR 14:00~15:50', 'Wu-chang Feng', '4.5/5', '3.5/5', "Web Security was fun and I learned a ton! This should be a required class. Wu Chang does and excellent job teaching it as well and is very helpful in and out of class. Not a tough grader and lenient if you talk to him about missing classes. There is a ton of work though for this class, so be prepared to put in the time! I'm happy I took this class!" ) value2 = ( 'CS201', 'Fall 2014', 'MW 10:00~11:50', 'Wu-chang Feng', '3/5', '3/5', "Professor Feng was a great professor. He is extremely knowledgeable, welcomes questions, and loves his material. The CTF homework makes the class enjoyable and was a good learning tool. Be prepared to spend a lot of time looking at assembly code." ) value3 = ( 'CS202', 'Fall 2018', '13:00~15:50', 'Karla Fant', '5/5', '4/5',
from flask import Flask, render_template, flash, redirect, url_for, session, logging, request from functools import wraps import requests from presenter import Presenter from model import AppModel app = Flask(__name__) model = AppModel() value1 = ( 'CS410 Web Security', 'Winter 2018', 'TR 14:00~15:50', 'Wu-chang Feng', '4.5/5', '3.5/5', "Web Security was fun and I learned a ton! This should be a required class. Wu Chang does and excellent job teaching it as well and is very helpful in and out of class. Not a tough grader and lenient if you talk to him about missing classes. There is a ton of work though for this class, so be prepared to put in the time! I'm happy I took this class!" ) value2 = ( 'CS201', 'Fall 2014', 'MW 10:00~11:50', 'Wu-chang Feng', '3/5', '3/5', "Professor Feng was a great professor. He is extremely knowledgeable, welcomes questions, and loves his material. The CTF homework makes the class enjoyable and was a good learning tool. Be prepared to spend a lot of time looking at assembly code." ) value3 = ( 'CS202', 'Fall 2018', '13:00~15:50', 'Karla Fant', '5/5', '4/5', "Took 163 and 202. Excellent teacher. Very engaging, in depth lectures. Love the fact that she put in labs, helps me practice what I learned in class. Responsive to emails! But if you fail ONE assignment, exam, or demo tho you insta fail. However I've graders are pretty lenient for programs-as long it works it basically passes. But exams are hard!" ) model.insert_course(value1) model.insert_course(value2) model.insert_course(value3) ''' model.insert_course(model, value1) model.insert_course(model, value2)