1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
| #Le 29/06/2020
#Python 3.9.0b3 (tags/v3.9.0b3:b484871, Jun 9 2020, 20:36:59) [MSC v.1924 64 bit (AMD64)] on win32
#Auteur: Roland ROCHE
#-*- coding: utf-8 -*-
#coding: utf-8
from tkinter import *
from tkinter.filedialog import askopenfilename
#créer une fenêtre principale:
fen = Tk()
fen.title("Mon App ")
fen.config(bg='white')
screen_x = int(fen.winfo_screenwidth())
screen_y = int(fen.winfo_screenheight())
window_x = 755
window_y = 650
posX = (screen_x //2)-(window_x//2)
posY = (screen_y //2)-(window_y//2)
geo = ("{}x{}+{}+{}").format(window_x, window_y, posX, posY)
fen.resizable(width =False, height =False)
fen.geometry(geo)
#Définition des fonctions
def Nouveau():
import tkinter.filedialog
f=tkinter.filedialog.askopenfile(
title="Nouveau"),
filetypes=(open,'All files',';*','CVS files', 'cvs','a')
print()
def Ouvrir():
import tkinter.filedialog
Tk().withdraw()
f=tkinter.filedialog.askopenfile(
title="Ouvrir"),
filetypes=([(open,'All files', '*', "a", 'text files', 'txt')])
print()
def Enregistrer():
import tkinter.filedialog
f=tkinter.filedialog.asksaveasfile(
title="Enregistrer...un fichier"),
filetypes=(open,'CVS files','cvs'),
print()
def Enregistrersous():
import tkinter.filedialog
f=tkinter.filedialog.asksaveasfile(
title="Enregistrer...un fichier sous"),
filetypes=('CVS files','cvs')
print()
def Quitter():
print("Quitter...Ctrl+Q")
def alert():
#showinfo_Menubar ,("alerte", "Bravo")
showinfo_Menubar = open_menubar("alerte", "Bravo")
menubar = Menu(fen)
menu1 = Menu(menubar, tearoff=0)
menu1.add_command(label="Nouveau Ctrl+N", command=Nouveau)
menu1.add_command(label="Ouvrir Ctrl+O", command=Ouvrir)
menu1.add_command(label="Enregistrer Ctrl+S", command=Enregistrer)
menu1.add_command(label="Enregistrer Sous Ctrl+Maj+S", command=Enregistrersous)
menu1.add_separator()
menu1.add_command(label="Quitter", command=Quitter)
menubar.add_cascade(label="Fichier", menu=menu1)
fen.config(menu=menubar)
fen.mainloop() |
Partager