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
|
from tkinter import *
from tkinter import ttk
LARGEFONT =("Verdana", 35)
def next_frame(frame):
frame.tkraise()
def erase_frame(frame):
frame.grid_forget()
for frame in (f1, f2, f3, f4):
frame.grid(row=0, column=4, sticky='n')
root = Tk()
f1 = Frame(root, bg='#0059b3')
f2 = Frame(root, bg='#0059b3')
f3 = Frame(root, bg='#0059b3')
f4 = Frame(root, bg='#0059b3')
#frame_lst=[f1,f2,f3,f4]
Label(f1, text='Menu des potions', bg='#0059b3', font=LARGEFONT).pack()
Label(f1, text=' ', bg='#0059b3').pack()
Button(f1, text='alller pg 2', command=lambda:erase_frame(f1), command=lambda:next_frame(f2)).pack()
Label(f2, text='FRAME 2').pack()
Button(f2, text='alller pg 3', command=lambda:erase_frame(f2), command=lambda:next_frame(f3)).pack()
Label(f3, text='FRAME 3').pack(side='left')
Button(f3, text='alller pg 4', command=lambda:erase_frame(f3), command=lambda:next_frame(f4)).pack(side='left')
Label(f4, text='FRAME 4').pack()
Button(f4, text='alller pg 1', command=lambda:erase_frame(f4), command=lambda:next_frame(f1)).pack()
root['bg'] = '#0059b3'
root.minsize(width=500, height=750)
root.maxsize(width=500, height=750)
root.mainloop() |