Skip to content

Instantly share code, notes, and snippets.

@RaminNietzsche
Created July 13, 2014 08:14
Show Gist options
  • Save RaminNietzsche/541ef81cf944628fe866 to your computer and use it in GitHub Desktop.
Save RaminNietzsche/541ef81cf944628fe866 to your computer and use it in GitHub Desktop.
mainloop()
#!/usr/sbin/env python
from Tkinter import *
#from ttk import *
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()
win.mainloop()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment