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
|
# -*- coding: utf-8 -*-
from varfunction import *
def set_frame():
#================== Création de la fenêtre principale ================
fenetre_pce =tk.Tk() # Fenêtre prinicpale
fenetre_pce.title("Menesis... se souvenir !")
screen_x = int(fenetre_pce.winfo_screenwidth()) # Fonction centrer fenêtre
screen_y = int(fenetre_pce.winfo_screenheight())
fenetre_pce_x = 1260
fenetre_pce_y = 768
pos_x = (screen_x // 2) - (fenetre_pce_x // 2)
pos_y = (screen_y // 2) - (fenetre_pce_y // 2)
geo = "{}x{}+{}+{}".format(fenetre_pce_x, fenetre_pce_y, pos_x, pos_y) # Attention le 1er facteur est x ensuite +
fenetre_pce.geometry(geo)
fenetre_pce.resizable(width=True,height=True) # Fenêtre modifiable True or False
fenetre_pce.iconbitmap("img/search.ico") ### Changement de l'icone de la fenêtre [l'icone doit être placé dans le répertoire racine de l'application ou un autre répertoire img/...]
return fenetre_pce # ne pas oublier de retourner
if __name__ == '__main__':
mainframe = set_frame()
#=================== Création d'un menu ==============================
menubar = Menu(mainframe,borderwidth=20, relief=GROOVE) # Création de la FRAME pour placer les menus dans le constructeur ==> fenetre =Tk()
menuFichier = Menu(menubar, tearoff=0) # Création du menu "Fichier"
menubar.add_cascade(label="Fichier", menu=menuFichier) # Rattachement des commandes au menu "Fichier"
menuFichier.add_command(label="Créer")
menuFichier.add_command(label="Ouvrir",)
menuFichier.add_command(label="Editer")
menuFichier.add_separator() # Ligne de séparation
#menuFichier.add_command(label="Quitter",command=mainframe.quit)
menuEdition = Menu(menubar, tearoff=0)
menubar.add_cascade(label="Edition", menu=menuEdition)
menuEdition.add_command(label="Couper")
menuEdition.add_command(label="Copier")
menuEdition.add_command(label="Coller")
menuEdition.add_command(label="Créer")
menuAuteur = Menu(menubar, tearoff=0)
menubar.add_cascade(label="Auteur", menu=menuAuteur)
#menuAuteur.add_command(label="Créer", command=write_auteur)
#menuAuteur.add_command(label="Consulter")
menuCitation = Menu(menubar, tearoff=0)
menubar.add_cascade(label="Citation", menu=menuCitation)
#menuCitation.add_command(label="Créer", command=write_citation)
#menuCitation.add_command(label="Consulter", command=result_citation)
menuLien = Menu(menubar, tearoff=0)
menubar.add_cascade(label="jw.org", menu=menuLien)
menuLien.add_command(label="Jw", command=open_jw_org)
menuLien.add_command(label="Bibliothèque", command=open_jw_wol)
menuAide = Menu(menubar, tearoff=0)
menubar.add_cascade(label="Aide", menu=menuAide)
menuAide.add_command(label="A propos")
mainframe.config(menu=menubar) # Configuration et print menu
#----------------------------------------------------------------
#Citation accueil
lblcitation = Label(mainframe, text=" Recherches et connaissance", font=("Arial", 14,"bold"))
lblcitation.pack()
# Fond d'écram accueil
frontimage = ImageTk.PhotoImage(Image.open("img/connaissance_1260-720.jpg") ) # image de fond page d'accueil
frontimagelabel = Label(mainframe, image=frontimage)
frontimagelabel.pack(expand=1)
#== Fermeture de la boucle principale ==
mainframe.mainloop() # Boucle principale |
Partager