Created
July 11, 2014 14:52
-
-
Save vahit/f338286b60c3cf987260 to your computer and use it in GitHub Desktop.
sample multi window application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/env python | |
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) | |
bt = ttk.Button(frame1, text='Next', command=show_frame2) | |
bt.grid(row=1, column=0) | |
frame1.grid() | |
def show_frame1(): | |
global frame2, create_frame1 | |
try: | |
frame2.destroy() | |
except: | |
pass | |
create_frame1() | |
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) | |
bt1 = ttk.Button(frame2, text='Next', command=show_frame3) | |
bt1.grid(row=1, column=1) | |
bt2 = ttk.Button(frame2, text='Back', command=show_frame1) | |
bt2.grid(row=1, column=0) | |
frame2.grid() | |
def show_frame2(): | |
global farme1, frame3, create_frame2 | |
try: | |
frame3.destroy() | |
except: | |
frame1.destroy() | |
create_frame2() | |
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) | |
bt1 = ttk.Button(frame3, text='Back', command=show_frame2) | |
bt1.grid(row=1, column=0) | |
bt2 = ttk.Button(frame3, text='Quit', command=win.destroy) | |
bt2.grid(row=1, column=1) | |
frame3.grid() | |
def show_frame3(): | |
global frame2, create_frame3 | |
try: | |
frame2.destroy() | |
except: | |
pass | |
create_frame3() | |
show_frame1() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment