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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
| def ShowFrameStocker(main_win,frame):
delete_frame(main_win)
frame.tkraise()
###############################################################################
## Creation d'un texte
Text = Label(main_win, text="premier texte", fg='DodgerBlue4', font=("Helvetica", 16, "bold"), anchor="center")
Text.grid()
nb_of_columns = 2 # to be replaced by the relevant number
Data= Label(main_win,text="data : ", fg='black', borderwidth=2, relief="groove" ,font=("Helvetica", 9, "italic","bold"),bg =_from_rgb((252, 252, 255)))
Data.grid(row=1, sticky='we', columnspan=nb_of_columns, pady = 10) # sticky='ew' expands the label horizontally
comboExample = ttk.Combobox(main_win,state="readonly", width = 70)
comboExample.grid()
comboExample.bind("<<ComboboxSelected>>", callbackFunc)
#Label
DataMET = Label(main_win,text="Check data : ", fg='black', borderwidth=2, relief="groove" ,font=("Helvetica", 9, "italic","bold"),bg =_from_rgb((252, 252, 255)))
DataMET.grid(row=3, sticky='we', columnspan=nb_of_columns, pady = 10) # sticky='ew' expands the label horizontally
#Label
Nom = Label(main_win,text="Nom : ")
Nom.grid(column = 0, pady = 10) # sticky='ew' expands the label horizontally
#
#Label
NomValue = Label(main_win,text="_____",anchor=W)
NomValue.grid(row= 4,column = 1, pady = 10) # sticky='ew' expands the label horizontally
if __name__ == "__main__":
global main_win
global first_frame
global path
path = os.path.dirname(os.path.realpath(__file__))
main_win = Tk()
main_win.configure(bg='lavender')
main_win.title("toto")
main_win.geometry("680x400")
###############################################################################
## Creation d'un frame pour la page d'accueil
first_frame = Frame(main_win)
first_frame.place(x=0, y=0, width=500, height=500)
first_frame.grid(row=1, column=0)
# main_win.rowconfigure(6, weight=1)
main_win.columnconfigure(0, weight=1)
third_frame = Frame(main_win)
third_frame.grid_forget()
# label_8 = Label(second_frame, text="Welcome to page 2",width=20,font=("bold", 10))
# label_8.place(x=70,y=230)
###############################################################################
## Creation d'un bouton suivant
bouton_Stocker = Button(main_win, text='Cliquez ici', command=lambda:ShowFrameStocker(main_win,third_frame), height=3, width=20)
bouton_Stocker.grid(row=4, column=0)
lbl1 = Label(main_win, text="Test TKinter", fg='DodgerBlue4', font=("Helvetica", 16, "bold"))
lbl1.grid(row=0, column=0)
main_win.mainloop() |
Partager