Développeuses, Développeurs, Bonjour !

Il me faut faire passer un Entry depuis la fenetre "Configurer" vers le champs "date" / le tout étant dans une classe.

Le cheminement étant :

Menu /Configurer/Preferences/ on rentre le "lieu" / il doit etre récupéré /
lors d' un OK sur le bouton "date".

Merci pour tout tuyau!

Voici le code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
 
# -*- coding: utf-8 -*-
 
#--- user variable ---
usingIDLE = 0                    #set = 1 if running from IDLE, otherwise 0
 
# Def des variables
liste_def = ["aaaaaaa","bbbbbbb"]
 
#--- modules ---
import tkMessageBox, tkSimpleDialog, tkFileDialog, string
import os.path, glob, sys
import Tkinter as tk
 
from datetime import date
 
 
 
#--- classes ---
class uiClass:
 
    def __init__ (self,master,ar,xy,flex):
 
        menubar = tk.Menu   (master)
        master.config   (menu=menubar)
 
        menuConfig = tk.Menu (menubar,tearoff=0)
 
        # Aide sous-menus
        menuConfig.add_command  (label='Preferences',
                                             underline=0,command = self.Pref )
 
        menubar.add_cascade (label='Configurer',
                            menu=menuConfig,
                            underline=0)
 
 
 
        # create the main GUI window with its menu object
        self.frame = tk.Toplevel    (relief='ridge', borderwidth=2, menu=menubar)
 
        # (dis)allow resize horiz/vertical
        self.frame.resizable    (flex,flex)
 
 
        # widgets     
        btn_date = tk.Button    (self.frame,
                                text='date',
                                width=10, bd=4,
                                command = self.lance_date)
        btn_date.grid (row=1, column=4, sticky=tk.N , padx=20, pady=5 )
 
 
        # champs
        self.frame.ch_date = tk.Text   (self.frame,
                            width = '30', height='1',
                            font = ( 'Arial',10,'normal') )
        self.frame.ch_date.configure  (bg='ivory')
        self.frame.ch_date.grid (row=1, column=5, sticky=tk.N+tk.E , padx=5)
 
 
 
 
        # DATE par default
        self.date_def = date.today().strftime("%d %b %Y")
        print self.date_def
 
 
    # end def self.__init__
 
 
    # LES FONCTIONS
 
    def Pref (self) :
        fen1 = tk.Tk()
        inf_1 = tk.Label ( fen1 , text = 'Lieu :' )
        inf_1.grid(row=1)
        ent_1 = tk.Entry ( fen1 )
        ent_1.grid ( row=1, column=1 )
        btn_10 = tk.Button ( fen1 , text = 'OOK' , command = fen1.destroy )
        btn_10.grid ( row=2, column=1 )              
        lieu_1 = ent_1.get ()
        print lieu_1
        liste_def [0] = lieu_1
        return liste_def
        fen1.mainloop()
 
 
 
    def lance_date ( self ):
        quest_date = tkMessageBox.askyesno ( title='La date', message = 'Voulez-vous la date d aujourd hui ?', default='yes' )
        if quest_date :
            print liste_def[0]
            self.frame.ch_date.delete ( 1.0 , tk.END) 
            self.frame.ch_date.insert ( tk.END, self.date_def + " " + liste_def[0] )
 
 
 
if __name__ == '__main__':
    root = tk.Tk()
    root.title  ('Lettres')
    # suppress unwanted window
    root.withdraw()
    # main GUI, the parameter 0 means resizing turned off
    mainUI = uiClass(root,
                    '850x700',
                    '+300+5',
                    0)
    if not usingIDLE:
        root.mainloop()