import os import random import save_load import math sl = save_load.StartMenu() old_save = sl.load(file_name='master_save_file') new_save = {} for i in range(1000): random.seed(i) new_save[str(i)] = { 'horizontal' : random.random() * 180.0, 'vertical' : random.random() * 180.0 } sl.save(items=old_save, file_name='temp_save') sl.save(items=new_save, file_name='master_save_file') os.system('py presentation_example.py') x = input("Press enter to continue:") sl.save(items=old_save, file_name='master_save_file')
import save_load from flask import Flask, render_template, request, make_response, jsonify app = Flask(__name__) start_menu = save_load.StartMenu() all_items = start_menu.load(file_name='master_save_file') #app.secret_key = b'_5#y2L"F4Q8z\n\xec]/' current_selection = "" blank_item = {'name': ''} @app.route('/') def hello_world(): return render_template('index.html', result=all_items.keys()) @app.route('/add') def add_items(): return render_template('add_item.html') @app.route('/selected_index', methods=['POST']) def get_item(): req = request.get_json() print(req, flush=True) current_selection = req['name'].strip() response = make_response(jsonify(all_items[current_selection]), 200) return response @app.route('/add/submit', methods=['POST'])
def setUp(self): self.sl = save_load.StartMenu() self.old_save = self.sl.load(file_name='master_save_file') self.sl.save(items=self.old_save, file_name='../temp_save') print(os.getcwd())