Voici mon code.
Oui je voudrais ajouter des widgets dans mes fenetres pop-up
from tkinter import *
Creer une 1ere fenetre
window = Tk()
top = Toplevel(window)
Personnaliser top
top.title("Inscription")
top.geometry("1080x720")
top.minsize(480, 360)
top.configure(bg=’dark blue’)
Personnaliser window
window.title("Lose Weight")
window.geometry("1080x720")
window.minsize(480, 360)
window.configure(background=’dark blue’)
TopLevel
def Ouvrir_inscription(master=None):
top = Toplevel()
top.title("S’inscrire")
top.geometry(’1080x720’)
top.configure(bg=’dark blue’)
label = Label(top, text="S’inscrire", font=(’Verdana’, 40, 'bold italic underline’), fg=’black’, bg=’dark blue’)
label.pack()
def Ouvrir_Questionnaire():
top2 = Toplevel()
top2.title("Questionnaire")
top2.geometry(’1080x720’)
top2.configure(bg=’dark blue’)
label2 = Label(top2, text="REPONDEZ AU QUESTIONNAIRE" ,font=(’Verdana’, 30, 'bold italic underline’), fg=’black’, bg=’dark blue’)
label2.pack()
mainmenu = Menu(window)
first_menu = Menu(mainmenu)
first_menu.add_command(label="Inscription", command=Ouvrir_inscription)
first_menu.add_command(label="Questionnaire", command=Ouvrir_Questionnaire)
first_menu.add_command(label="Questionnaire3")
second_menu = Menu(mainmenu)
second_menu.add_command(label="Reponse1")
second_menu.add_command(label="Reponse2")
thirst_menu = Menu(mainmenu)
thirst_menu.add_command(label="Quitter…", command=window.destroy)
mainmenu.add_cascade(label="Commencer", menu=first_menu)
mainmenu.add_cascade(label="Finir", menu=second_menu)
mainmenu.add_cascade(label="Parametres", menu=thirst_menu)
radio_widgetH = Radiobutton(top, text="Homme", value=1)
radio_widgetF = Radiobutton(top, text="Femme", value=2)
B1 = Button(mainmenu, text="Infos", relief=RAISED, bitmap="info")
B1.pack()
Creer une frame
frame = Frame(window, bg=’dark blue’, bd=2, relief=RAISED, width=100, height=100)
frame2 = Frame(top, bg=’powder blue’, bd=2, relief=RAISED)
frame2.pack()
label_top = Label(top, text="Quel est votre sexe ?")
label_top.pack()
Ajouter un 1er texte
label_title = Label(frame, text="Bienvenue sur Lose Weight !", font=("Helvetica", '40’, 'bold italic’), bg=’dark blue’, fg=’white’)
label_title.pack()
Ajouter un second texte
label_subtitle = Label(frame, text="Avant de faire du sport… MANGEZ EQUILIBRÉ!", font=("Helvetica", '18’, 'bold’), bg=’dark blue’, fg=’white’)
label_subtitle.pack()
Ajouter
radio_widgetH.pack()
radio_widgetF.pack()
frame.pack(expand=YES)
menu_bar = Menu(window)
file_menu = Menu(menu_bar, tearoff=0)
Afficher
window.config(menu=mainmenu)
window.mainloop()