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
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import Tkinter as tk
class Frame_mode_1(tk.Frame):
def __init__(self,master):
tk.Frame.__init__(self,master)
self.txt = tk.Label(self, text = 'FRAME MODE 1',width=25)
self.txt.pack()
class Frame_mode_2(tk.Frame):
def __init__(self,master):
tk.Frame.__init__(self,master)
self.txt = tk.Label(self, text = 'FRAME MODE 2',width=25)
self.txt.pack()
class simpleapp_tk(tk.Tk):
#constructor
def __init__(self,parent):
tk.Tk.__init__(self,parent)
self.parent = parent
self.mode = tk.IntVar()
self.mode.set(0)
self.initialize()
def initialize(self):
self.Frame_b = tk.Frame(self,borderwidth=0,width=800,height=200)
self.Frame_b.pack(side=tk.BOTTOM)
self.Frame_1 = Frame_mode_1(self)
self.Frame_2 = Frame_mode_2(self)
self.Frame_main = self.Frame_1
self.Frame_main.pack()
self.b_launch = tk.Button(self.Frame_b,text='Go',width = 25,command=self.calculations)
self.b_launch.pack()
self.b_quit = tk.Button(self.Frame_b,text='Quit',width = 25,command=self.close_windows)
self.b_quit.pack()
def close_windows(self):
self.destroy()
def calculations(self):
self.Frame_main = self.Frame_2
self.Frame_main.tkraise()
print 'Go'
###############################################################
###############################################################
###############################################################
if __name__ == "__main__":
app = simpleapp_tk(None)
app.title('test')
app.mainloop() |
Partager