Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_multiwin.py
- from tkinter import *
- from tkinter import ttk
- win=Tk()
- def create_frame1():
- global show_frame2, frame1
- frame1=ttk.Frame(win)
- lbl=ttk.Label(frame1, text='Frame1', font='Times 35')
- lbl.grid(row=0, column=0, columnspan=2)
- bt_next=ttk.Button(frame1, text='Next', command=show_frame2)
- bt_quit=ttk.Button(frame1, text='Quit', command=win.destroy)
- bt_next.grid(row=1, column=1)
- bt_quit.grid(row=1, column=0)
- def show_frame1():
- global frame2, frame1
- frame2.grid_forget()
- frame1.grid()
- def create_frame2():
- global show_frame3, show_frame1, frame2
- frame2=ttk.Frame(win)
- lbl=ttk.Label(frame2, text='Frame2', font='Times 35')
- lbl.grid(row=0, column=0, columnspan=2)
- bt_next=ttk.Button(frame2, text='Next', command=show_frame3)
- bt_next.grid(row=1, column=1)
- bt_back=ttk.Button(frame2, text='Back', command=show_frame1)
- bt_back.grid(row=1, column=0)
- def show_frame2():
- global farme1, frame3, frame2
- frame3.grid_forget()
- frame1.grid_forget()
- frame2.grid()
- def create_frame3():
- global show_frame2, frame3
- frame3=ttk.Frame(win)
- lbl=ttk.Label(frame3, text='Frame3', font='Times 35')
- lbl.grid(row=0, column=0, columnspan=2)
- bt_back=ttk.Button(frame3, text='Back', command=show_frame2)
- bt_back.grid(row=1, column=0)
- bt_quit=ttk.Button(frame3, text='Quit', command=win.destroy)
- bt_quit.grid(row=1, column=1)
- def show_frame3():
- global frame2, frame3
- frame2.grid_forget()
- frame3.grid()
- def main():
- create_frame1()
- create_frame2()
- create_frame3()
- show_frame1()
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement