Bonjour

Je suis débutante en python, j'utilise la version 2.7.
J'ai fait un mini-programme avec bouton qui donne un ordre a mon serveur via sshpass.
Je voudrais ajouter un sous-menu à mon programme.

Mais quand j'ajoute le menu, et exécute mon programme, le curseur reste bloqué, le programme ce bloque et ne s'affiche pas a l'écran ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
laurent@laurent-Bureau:~$ python ~/python/Cours/serveur.py
_
et suis obligé de fermer la console.


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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
 
#!/usr/bin/python
# -*- coding: utf-8 -*-
 
from Tkinter import *
from os import system         
from tkMessageBox import *
 
#----------- CONFIGURATION ----------
mdp = "mot de passe"
login = "serveur"
hote = "192.168.0.1"  
 
def notdone():  
    showerror('Not implemented', 'Not yet available') 
 
def makemenu(parent):
    menubar = Frame(parent)                        
    menubar.pack(side=TOP, fill=X)
 
    fbutton = Menubutton(menubar, text='File', underline=0)
    fbutton.pack(side=LEFT)
    file = Menu(fbutton)
    file.add_command(label='New...',  command=notdone,     underline=0)
    file.add_command(label='Open...', command=notdone,     underline=0)
    file.add_command(label='Quit',    command=parent.quit, underline=0)
    fbutton.config(menu=file)
 
    ebutton = Menubutton(menubar, text='Edit', underline=0)
    ebutton.pack(side=LEFT)
    edit = Menu(ebutton, tearoff=0)
    edit.add_command(label='Cut',     command=notdone,     underline=0)
    edit.add_command(label='Paste',   command=notdone,     underline=0)
    edit.add_separator()
    ebutton.config(menu=edit)
 
    submenu = Menu(edit, tearoff=0)
    submenu.add_command(label='Spam', command=parent.quit, underline=0)
    submenu.add_command(label='Eggs', command=notdone,     underline=0)
    edit.add_cascade(label='Stuff',   menu=submenu,        underline=0)
    return menubar
 
 
class App:
 
    def __init__(self, master):
 
        frame = Frame(master)
        frame.grid()        
 
        #------------------------------ Ligne 3 ------------------------------
        self.texte3_1 = Label(frame, text = " test1 ") 
        self.texte3_1.grid(row = 3, column = 0, sticky = W)
 
        self.texte3_2 = Label(frame, text = " E1 ") 
        self.texte3_2.grid(row = 3, column = 1, sticky = W)
 
        #self.text2 = Text(frame, width = 3, height = 1 )
	#self.text2.grid( row = 1,column=2 )
	#self.text2.insert( INSERT, "E1" )        
 
        self.bt1_on = Button(frame, text="Allumer", command=self.cu1_on)
        self.bt1_on.grid(row=3,column=2)
 
        self.bt1_off = Button(frame, text="Eteindre", command=self.cu1_off)
        self.bt1_off.grid(row=3,column=3)
 
        self.bt1_bright = Button(frame, text="Bright", command=self.cu1_bright)
        self.bt1_bright.grid(row=3,column=4)
 
        self.bt1_dim = Button(frame, text="Dim", command=self.cu1_dim)
        self.bt1_dim.grid(row=3,column=5)
 
        #------------------------------ Ligne 4 ------------------------------
 
        self.texte4_1 = Label(frame, text = " Test ") 
        self.texte4_1.grid(row = 4, column = 0, sticky = W)
 
        self.texte4_2 = Label(frame, text = " E2 ") 
        self.texte4_2.grid(row = 4, column = 1, sticky = W)
 
        self.bt2_on = Button(frame, text="Marche", command=self.cu2_on)
        self.bt2_on.grid(row=4,column=2)
 
        self.bt2_off = Button(frame, text="Arrêt", command=self.cu2_off)
        self.bt2_off.grid(row=4,column=3)
 
        self.bt2_bright = Button(frame, text="Bright", command=self.cu2_bright)
        self.bt2_bright.grid(row=4,column=4)
 
        self.bt2_dim = Button(frame, text="Dim", command=self.cu2_dim)
        self.bt2_dim.grid(row=4,column=5)
 
 
# Fonction quand un bouton est presser
# Envoi un ordre x10 sur le serveur
    def panic_on(self):
        print "Touche panic"
        system('echo "x10 panic" | sshpass -p '+mdp+' ssh '+login+'@192.168.0.1')
 
    def cu1_on(self):
        print "Code Unité 1 on"
        system('echo "x10 e1 on" | sshpass -p '+mdp+' ssh '+login+'@192.168.0.1')
 
    def cu1_off(self):
        print "Code Unité 1 off"
        system('echo "x10 e1 off" | sshpass -p '+mdp+' ssh '+login+'@192.168.0.1')
 
    def cu1_bright(self):
        print "Code Unité 1 bright"
        system('echo "x10 e1 bright" | sshpass -p '+mdp+' ssh '+login+'@192.168.0.1')
        #"nc -c "echo pl $donne" localhost 1099
 
    def cu1_dim(self):
        print "bed 1 dim"
        system('echo "x10 e1 dim" | sshpass -p '+mdp+' ssh '+login+'@192.168.0.1')
 
    def cu2_on(self):
        print "Code Unité 2 on"
        system('echo "x10 e1 on" | sshpass -p '+mdp+' ssh '+login+'@192.168.0.1')
        #system("medit")
 
    def cu2_off(self):
        print "Code Unité 2 off"
        system('echo "x10 e1 off" | sshpass -p '+mdp+' ssh '+login+'@192.168.0.1')
 
    def cu2_bright(self):
        print "Code Unité 2 bright"
        system('echo "x10 e1 bright" | sshpass -p '+mdp+' ssh '+login+'@192.168.0.1')
        #"nc -c "echo pl $donne" localhost 1099
 
    def cu2_dim(self):
        print "bed 2 dim"
        system('echo "x10 e1 dim" | sshpass -p '+mdp+' ssh '+login+'@192.168.0.1') 
 
 
fen = Tk()
fen.title("Test")
fen.geometry("450x150") # Largeur X Hauteur
makemenu(fen)
app = App(fen)
fen.mainloop()
Pouvez-vous me dire comment résoudre ce problème ?
Esce due à une librairie manquante ?

Merci.