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
| #!/usr/local/bin/python
# -*- coding:utf-8 -*-
#-------------------------------------------------------------------------------------------------------
# IMPORTATIONS
#-------------------------------------------------------------------------------------------------------
from Tkinter import *
import Tkinter
import ttk
#-------------------------------------------------------------------------------------------------------
# FENETRES
#-------------------------------------------------------------------------------------------------------
root = Tkinter.Tk()
Label(root, text="fenetre principale").grid()
bt1 = ttk.Button(root, text="Quitter", command=root.destroy)
bt1.grid(row=2,column=0)
def creer_frames():
global frame, frame1, frame2, frame3, frame4
frame=Frame(root, width=400, height=150)
frame.grid()
frame1=Frame(frame, width=400, height=150)
frame1.grid(row=1,column=0)
frame2=Frame(frame, width=400, height=150)
frame2.grid(row=1,column=1)
frame3=Frame(frame, width=400, height=150)
frame3.grid(row=1,column=2)
frame4=Frame(frame, width=25, height=35)
frame4.grid(row=1,column=3)
def une_phrase():
global filewin
filewin = Toplevel(root)
Frame0 = Frame(filewin,borderwidth=2,relief=FLAT)
Frame0.pack(side=LEFT,padx=10,pady=10)
Frame1 = Frame(Frame0,borderwidth=2,relief=RAISED)
Frame1.pack(side=TOP,padx=10,pady=10)
Frame2 = Frame(Frame0,borderwidth=2,relief=FLAT)
Frame2.pack(side=TOP,padx=10,pady=10)
Label(Frame1, text="dites unr phrase").grid()
une_phrase = Text(Frame1, width=40, height=5, foreground='black', background='white')
une_phrase.grid()
bt1 = ttk.Button(Frame2, text="Quitter", command=root.destroy)
bt1.pack()
bt2 = ttk.Button(Frame2, text="Valider la recette", command=lambda x=une_phrase: valider_une_phrase(x))
bt2.pack()
def valider_une_phrase(valeur):
print
#recette = "%s" % valeur.get()
#recette = eval(recette)
un_mot = valeur.get()
print "un_mot : ", un_mot
creer_frames()
une_phrase()
root.mainloop() |
Partager