def down(): extension = ['.py', '.ico', '.png', '.xml', '.rels'] filename = [[ 'a_propos', 'dejavusans', 'edit_pref', 'entier', 'entier_deux_racines_plt', 'entier_equation', 'entier_pas_racine', 'entier_x0', 'entier_x1', 'entier_x2', 'erreur', 'exporter', 'exporter_graph', 'fraction', 'fraction_deux_racines_plt', 'fraction_equation', 'fraction_pas_racine', 'fraction_x0', 'fraction_x1', 'fraction_x1_delta_denom_entier', 'fraction_x1_delta_num_entier', 'fraction_x1_sinon', 'fraction_x2', 'fraction_x2_delta_denom_entier', 'fraction_x2_delta_num_entier', 'fraction_x2_sinon', 'linux_distribution', 'maj', 'menu', 'ouvrir', 'packages', 'packages_linux', 'prgm', 'quitter', 'sauvegarder', 'version', 'extensions/__init__', 'extensions/docx', 'extensions/html', 'extensions/rtf', 'extensions/tex', 'extensions/txt', 'extensions/xhtml', 'images/__init__', 'images/jpg', 'images/png' ], ['a_propos', 'avertissement', 'python'], [ 'a_propos_menu', 'coller_menu', 'copier_menu', 'couper_menu', 'exporter_menu', 'maj_menu', 'ouvrir_menu', 'package', 'preferences_menu', 'python', 'quitter_menu', 'sauvegarder_menu' ], [ 'extensions/docx/[Content_Types]', 'extensions/docx/numbering', 'extensions/docx/styles' ], ['extensions/docx/', 'extensions/docx/document.xml']] try: if not os.path.exists('extensions'): os.mkdir('extensions') if not os.path.exists('extensions/docx'): os.mkdir('extensions/docx') if not os.path.exists('images'): os.mkdir('images') for k in range(len(extension)): for i in range(len(filename[k])): url = 'https://raw.githubusercontent.com/rfoxinter/Python/master/EquationsSecondDegre/' + filename[ k][i] + extension[k] urllib.request.urlretrieve(url, filename[k][i] + extension[k]) maj_pref() importlib.reload(edit_pref) edit_pref.main( 'etat_maj', "'L\\u2019application a bien \\u00E9t\\u00E9 mise \\u00E0 jour.'", 2) except: importlib.reload(edit_pref) edit_pref.main( 'etat_maj', "'Une erreur est survenue lors de la mise \\u00E0 jour.'", 2) if os.path.exists('Appli') and version >= 55: for f in os.listdir('Appli'): os.remove(os.path.join('Appli', f)) os.rmdir('Appli')
police = font.Font(root, family='DejaVu Sans', size=10) root.option_add('*Font', police) Label(root, text=preferences.etat_maj, width=50).grid(column=0, row=0) bouton_fermer = Button(root, text='Fermer', command=root.destroy) bouton_fermer.grid(column=0, row=1) root.title('Mise \u00E0 jour') root.resizable(width=False, height=False) if os.name == 'nt': import ctypes ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( 'equations') img = PhotoImage(file='python.png') root.tk.call('wm', 'iconphoto', root._w, img) root.mainloop() import edit_pref edit_pref.main('etat_maj', "''", 2) version = 58 root = Tk() if not 'DejaVu Sans' in list(font.families()): root.destroy() import dejavusans dejavusans.main() else: root.destroy() latest = '' entier_val = [1, 0, 0] fraction_val = [1, 1, 0, 1, 0, 1] rep = ['', '', '', '', '', '', '']
def main(event=None): if preferences.export_graph == 0: import edit_pref edit_pref.main('export_graph', '1', 3) file_list = [('Joint Photographic Experts Group', '.jpg .jpeg'), ('Portable Network Graphics', '.png'), ('Scalable Vector Graphics', '.svg'), ('Portable Document Format', '.pdf')] file = asksaveasfile(title='Exporter le graphique', filetypes=file_list, defaultextension='.jpg') if file is None: return if prgm.latest == 'entier': a = prgm.entier_val[0] b = prgm.entier_val[1] c = prgm.entier_val[2] if b**2 - 4 * a * c < 0: import entier_pas_racine entier_pas_racine.main( a, b, c, -b, 2 * a, -b**2 + 4 * a * c, 4 * a, pathlib.Path(file.name).suffix.replace('.', ''), file.name) elif b**2 - 4 * a * c == 0: import entier_x0 entier_x0.main(a, b, c, -b, 2 * a, -b**2 + 4 * a * c, 4 * a, pathlib.Path(file.name).suffix.replace('.', ''), file.name) else: import entier_deux_racines_plt entier_deux_racines_plt.main( a, b, c, -b, 2 * a, -b**2 + 4 * a * c, 4 * a, b**2 - 4 * a * c, pathlib.Path(file.name).suffix.replace('.', ''), file.name) elif prgm.latest == 'fraction': a_n = prgm.fraction_val[0] a_d = prgm.fraction_val[1] b_n = prgm.fraction_val[2] b_d = prgm.fraction_val[3] c_n = prgm.fraction_val[4] c_d = prgm.fraction_val[5] delta_num = int(b_n**2 * a_d * c_d - 4 * a_n * c_n * b_d**2 + ((a_n / a_n) - 1)) delta_denom = int(a_d * b_d**2 * c_d) if delta_num > 0 and delta_denom < 0: delta_num = -delta_num delta_denom = -delta_denom if delta_num / delta_denom < 0: import fraction_pas_racine fraction_pas_racine.main( a_n, a_d, b_n, b_d, c_n, c_d, int(-b_n * a_d), int(2 * a_n * b_d), int(-delta_num * a_d), int(4 * a_n * delta_denom), pathlib.Path(file.name).suffix.replace('.', ''), file.name) elif delta_num == 0: import fraction_x0 fraction_x0.main(a_n, a_d, b_n, b_d, c_n, c_d, int(-b_n * a_d), int(2 * a_n * b_d), int(-delta_num * a_d), int(4 * a_n * delta_denom), pathlib.Path(file.name).suffix.replace('.', ''), file.name) else: import fraction_deux_racines_plt fraction_deux_racines_plt.main( a_n, a_d, b_n, b_d, c_n, c_d, int(-b_n * a_d), int(2 * a_n * b_d), int(-delta_num * a_d), int(4 * a_n * delta_denom), delta_num, delta_denom, pathlib.Path(file.name).suffix.replace('.', ''), file.name) file.close()
menu_fichier=prgm.Menu(menuBar,tearoff=0) menu_edition=prgm.Menu(menuBar,tearoff=0) menu_preference=prgm.Menu(menu_edition,tearoff=0) menu_aide=prgm.Menu(menuBar,tearoff=0) menu_fichier.add_command(label='Enregistrer l\u2019\u00E9quation Ctrl+S',image=sauvegarder_image,compound='left',command=sauvegarder.main,font=police) menu_fichier.add_command(label='Ouvrir une \u00E9quation Ctrl+O',image=ouvrir_image,compound='left',command=ouvrir.main,font=police) menu_fichier.add_separator() menu_fichier.add_command(label='Exporter l\u2019\u00E9quation Ctrl+Shift+E',image=exporter_image,compound='left',command=exporter.main,font=police) menu_fichier.add_command(label='Exporter le graphique Ctrl+Shift+G',image=exporter_image,compound='left',command=exporter_graph.main,font=police) menu_fichier.add_separator() menu_fichier.add_command(label='Quitter Ctrl+Q',image=quitter_image,compound='left',command=quitter.close,font=police) menuBar.add_cascade(label='Fichier',menu=menu_fichier) menu_preference.add_checkbutton(label='V\u00E9rifier automatiquement les mises à jour',variable=ver_maj,command=lambda:edit_pref.main('ver_maj',str(ver_maj.get()),0),font=police) menu_preference.add_checkbutton(label='Afficher les graphiques',variable=afficher_graphs,command=lambda:edit_pref.main('afficher_graphs',str(afficher_graphs.get()),1),font=police) menu_edition.add_command(label='Copier Ctrl+C',image=copier_image,compound='left',command=lambda:prgm.root.focus_get().event_generate('<<Copy>>'),font=police) menu_edition.add_command(label='Coller Ctrl+V',image=coller_image,compound='left',command=lambda:prgm.root.focus_get().event_generate('<<Paste>>'),font=police) menu_edition.add_command(label='Couper Ctrl+X',image=couper_image,compound='left',command=lambda:prgm.root.focus_get().event_generate('<<Cut>>'),font=police) menu_edition.add_separator() menu_edition.add_cascade(label='Pr\u00E9f\u00E9rences',image=preferences_image,compound='left',menu=menu_preference,font=police) menuBar.add_cascade(label='\u00C9dition',menu=menu_edition) menu_aide=prgm.Menu(menuBar,tearoff=0) menu_aide.add_command(label='\u00C0 propos',image=a_propos_image,compound='left',command=a_propos.main,font=police) menu_aide.add_separator() menu_aide.add_command(label='V\u00E9rifier les mises \u00E0 jour',image=maj_image,compound='left',command=quitter.abt_maj,font=police) menuBar.add_cascade(label='Aide',menu=menu_aide)