salut tout le monde,
j'ai absolument besoin de votre aide svp, cela fait longtemps que je travaille sur ce programme mais je trouve pas!!!
voilà:
j'ai fait un premier programme en python(general.py) avec lequel j'affiche une fenêtre dans laquelle il y a une liste de d'autres programmes en pour que l'utilisteur puisse choisir celui qu'il veut executer.

les programmes qui figure dans la liste sont aussi des programmes en python pour afficher une interface graphyque,pour chaque programme j'ai créer son propre executable.
le but est donc d'afficher la fenetre qui correspond au programme choisi par l'utilisateur ds la liste.
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
 
#general.py
from Tkinter import*
import Pmw
import os
def change():
	prog=combo.get()
	os.system("C:python24/projet/dist/%s "%(prog))
 
 
programmes =('ec2d', 'exercice2', 'eff','yfjvj', 'rdch', 'vgkghv')
 
fen = Pmw.initialise()
combo = Pmw.ComboBox(fen, labelpos =NW, label_text ='choississez votre programme:',scrolledlist_items = programmes,listheight = 100, selectioncommand = change)
combo.grid(row =2,columnspan =2,padx=10,pady =10)
 
fen.mainloop()
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
#ec2d.py
from Tkinter import*
import os
import Pmw
import webbrowser
from tkFileDialog import askopenfilename
from random import randrange
 
class MenuBar(Frame):
	def __init__(self, boss):
		Frame.__init__(self, borderwidth=2)
 
		#menu #
		fileMenu = Menubutton(self , text = 'File')
		fileMenu.pack(side=LEFT,padx='1')
		me1= Menu(fileMenu)
		me1.add_command(label ='New', underline =0,command = boss.nouveau)
		me1.add_command(label ='Open', underline =0, command = boss.ouvrir)
		me1.add_command(label ='Test', underline =0, command = boss.test)
		me1.add_command(label ='Number test', underline =0, command = boss.testnum)
		me1.add_command(label ='Save', underline =0,command = boss.save)
 
		edit = Menubutton(self , text='Edit')
		edit.pack(side=LEFT,padx='2')
		me2=Menu(edit)
		me2.add_command(label='Copy', underline =0, command = boss.copier)
		me2.add_command(label='Paste', underline =0, command = boss.coller)
 
		execute = Menubutton(self , text = 'Execute')
		execute.pack(side=LEFT,padx='3')
		me3= Menu(execute)
		me3.add_command(label='Run', underline =0, command = boss.run)
 
		help = Menubutton(self , text = 'Help')
		help.pack(side=LEFT,padx='4')
		me4=Menu(help)
		me4.add_command(label='Online documentation' , underline =0, command = boss.doc)
		me4.add_command(label='GUI for Python', underline=0, command = boss.gui)
 
 
		fileMenu.configure(menu = me1)
		edit.configure(menu = me2)
		execute.configure(menu = me3)
		help.configure(menu = me4)
 
		#creation des champs d'entree
		self.lab=Label(self, text='Proj',fg='red',font=('Comic Sans MS',11))
		self.lab.pack(padx=1,pady=1)
		self.E_1=Entry(self, textvariable=boss.fichname)
		self.E_1.pack(pady=1)
 
		self.lab=Label(self, text='Output',fg='red', font=('Comic Sans MS',11))
		self.lab.pack(padx=2,pady=2)
		self.E_2=Entry(self, textvariable=boss.output1)
		self.E_2.pack(pady=2)
 
		self.lab=Label(self, text='Plot',fg='red', font=('Comic Sans MS',11))
		self.lab.pack(padx=3,pady=3)
		self.E_3=Entry(self, textvariable=boss.plot1)
		self.E_3.pack(pady=3)
 
		self.lab=Label(self, text='Intpar',fg='red', font=('Comic Sans MS',11))
		self.lab.pack(padx=4,pady=5)
		self.E_4=Entry(self, textvariable=boss.intpar1)
		self.E_4.pack(pady=4)
 
		self.lab=Label(self, text='Doublepar',fg='red', font=('Comic Sans MS',11))
		self.lab.pack(padx=5,pady=6)
		self.E_5=Entry(self, textvariable=boss.doublepar1)
		self.E_5.pack(pady=5)
 
		self.lab=Label(self, text='ComplexparRe',fg='red', font=('Comic Sans MS',11))
		self.lab.pack(padx=6,pady=7)
		self.E_6=Entry(self, textvariable=boss.complexpar1)
		self.E_6.pack(pady=6)
 
		self.lab=Label(self, text='ComplexparIm',fg='red', font=('Comic Sans MS',11))
		self.lab.pack(padx=7,pady=8)
		self.E_7=Entry(self, textvariable=boss.complexpar2)
		self.E_7.pack(pady=7)
 
		self.lab=Label(self, text='Meshfile',fg='red', font=('Comic Sans MS',11))
		self.lab.pack(padx=9,pady=10)
		self.E_8=Entry(self, textvariable=boss.meshfile1)
		self.E_8.pack(pady=7)
 
		self.lab=Label(self, text='Auxfile',fg='red', font=('Comic Sans MS',11))
		self.lab.pack(padx=9,pady=10)
		self.E_9=Entry(self, textvariable=boss.auxfile1)
		self.E_9.pack(pady=9)
 
	    #creation des boutons
		self.bou1=Button(self, text='Run',command=boss.save)
		self.bou1.pack(side=LEFT,padx='20',pady='20')
 
		self.bou2=Button(self, text='Fill',command=boss.ouvrir)
		self.bou2.pack(side=LEFT,padx='25',pady='25')
 
		self.bou3=Button(self, text='Close', command = boss.destroy)
		self.bou3.pack(side=LEFT,padx='30',pady='30')
 
 
 
class Application(Frame):
 
	def __init__(self, boss =None):
		Frame.__init__(self)
 
		self.master.title('Resolution of EC2D')
		self.master.iconbitmap("ofeli.ico")
		image =('o','d','p','l')
		texte =('open','save','run','test')
 
		tip= Pmw.Balloon(self)
		toolbar= Frame(self, bd=1)
		toolbar.pack(expand=YES, fill=X)
		nbou= len(image)
		self.photoI=[NONE]*nbou
		for b in range(nbou):
			self.photoI[b]= PhotoImage(file=image[b]+'.gif')
			bou=Button(toolbar, image=self.photoI[b], relief=GROOVE, command= lambda arg=b:self.action(arg))
			bou.pack(side=LEFT)
			tip.bind(bou, texte[b])
 
		self.fichname=StringVar()
		self.output1=StringVar()
		self.plot1=StringVar()
		self.intpar1=StringVar()
		self.doublepar1=StringVar()
		self.complexpar1=StringVar()
		self.complexpar2=StringVar()
		self.meshfile1=StringVar()
		self.auxfile1=StringVar()
 
		mBar = MenuBar(self)
		mBar.pack()
 
		self.can = Text(self,state=DISABLED,height=2,fg='black'); 
		self.can.pack()
		self.pack()
 
 
	def ouvrir(self):
		name = askopenfilename(filetypes = [("all","*"),("python","*.dat")])
		if name:
			try:
				fichier = open(name,"r")
			except:
				self.message("Error this file can not be opened\n")
			else:
					#obtenir le contenu du fichier sous forme d'une liste de lignes
					L=fichier.readlines()
					#on ferme le fichier
					fichier.close()
					#print L
					#print
					#on retir les caracters de fin de ligne'\r' et/ou '\n'
					L=[x.rstrip('\r\n') for x in L]
 
					#on transforme chaque ligne en sous -liste[clé, valeur]
					L=[x.split() for x in L]
 
					#elimine la premiere et derniere ligne
					L=L[1:-1]
 
					#elimine les lignes de commentaires
					L=[x for x in L if x[0]!="#"]
					print L
 
					a= L[0][1]
					self.fichname.set(a)
					b=L[1][1]
					self.output1.set(b)
					c=L[2][1]
					self.plot1.set(c)
					d=L[3][1]
					self.intpar1.set(d)
					e=L[4][1]
					self.doublepar1.set(e)
					f=L[5][1]
					self.complexpar1.set(f)
					i=L[5][2]
					self.complexpar2.set(i)
					g=L[6][1]
					self.meshfile1.set(g)
					h=L[7][1]
					self.auxfile1.set(h)			    
		else:
				self.message("no file selected!")
 
 
 
	def testnum(self):
		num1=self.output1.get()
		num2=self.plot1.get()
		num3=self.intpar1.get()
		num4=self.doublepar1.get()
		num5=self.complexpar1.get()
		num6=self.complexpar2.get()
 
		if num1:
			try:
				num1=int(num1)
			except:
				self.message("illegal caracter in output\n")
			else:
				try:
					num2=int(num2)
				except:
					self.message("ilegal caracter plot\n")
				else:
					try:
						num3=int(num3)
					except:
						self.message("illegal caracter intpar\n")
					else:
						try:
							num4=int(num4)
						except:
							self.message("illegal caracter doublepar\n")
						else:
							try:
								num5=int(num5)
							except:
								self.message("illegal caracter complex real part\n")
							else:
								try:
									num6=int(num6)
								except:
									self.message("illegal caracter complex imaginaty part\n")
								else:
								    self.message("all the numbers are ok\n")
 
	def test(self) :
 
		fichier1=self.fichname.get()
		taille1=len(fichier1)
		fichier2=self.meshfile1.get()
		taille2=len(fichier2)
		fichier3=self.auxfile1.get()
		taille3=len(fichier3)
 
		if fichier1:
 
			#try:
			#	fich1 = open('%s'%(fichier1),'r')
			#except:
			#	self.message("the data file can't be opened\n")
			#else:
				#if (str(fich1.readline())) != '#PARAM!\n' :
 
				#			             self.message("Error, the written name isn't a datafile\n")
				#			             self.E_1.delete(0,taille1)
				#			             fich1.close()
				#else:
 
					try:
					    fich2 = open('C:/python24/projet/ofeli/tests/demos/electromagnetics/eddycurrent2d-1/%s'%(fichier2),'r')
					except:
						self.message("the mesh file can't not be opened\n")
					else:
					    if (str(fich2.readline())) != '#MESH!\n' :
									                self.message("Error, the written name isn't a meshfile\n")
									                self.E_8.delete(0,taille2)
													#fich2.close()
					    else:
						    try:
							    fich3 = open('C:/python24/projet/ofeli/tests/demos/electromagnetics/eddycurrent2d-1/%s'%(fichier3),'r')
						    except:
						              self.message("the aux file can't be opened\n")
						    else:
						        if (str(fich3.readline())) != '#MESH!\n' :
 
									                                        self.message("Error, the written name isn't a auxfile\n")
									                                        self.E_9.delete(0,taille3)
																			#fich3.close()
						        else:
							        self.message("you can execute\n")
									#fich2.close()
									#fich3.close()
 
 
	def message(self, text):
		self.can.config(state=NORMAL)
		self.can.insert(END,text)
		self.can.config(state=DISABLED)
 
	def nouveau(self):
 
		a=" project"
		self.fichname.set(a)
		b=1
		self.output1.set(b)
		c=1
		self.plot1.set(c)
		d=1
		self.intpar1.set(d)
		e=10
		self.doublepar1.set(e)
		f=10
		self.complexpar1.set(f)
		i=0
		self.complexpar2.set(i)
		g="project.m"
		self.meshfile1.set(g)
		h="project.m"
		self.auxfile1.set(h)
 
 
	def doc(self):
		webbrowser.open("http://ofeli.net") 
 
	def gui(self):
		webbrowser.open("http://infohost.nmt.edu/tcc/help/pubs/tkinter/")
 
	def copier(self):
		w.openClipboard()
		d=GetClipboardData(win32con.CF_TEXT)
		w.CloseClipboard()
		return d
 
 
	def coller(self):
		w.openclipboard()
		w.EmptyClipboard()
		w.SetClipboardData(aType,aString)
		w.closeClipboard()
 
	def action(self,b):
		if b==0:
			self.ouvrir()
		elif b==1:
			self.save()
		elif b==2:
			self.run()
		elif b==4:
		    self.test()
 
	#def annuler(self):
 
 
	#def retablir(self):
 
 
	#def seletionner(self):
 
 
 
	def save(self) :
		name=self.fichname.get()
		file = open("%s"%(name),'w')
 
		file.write('#PARAM!\n')
		file.write('Proj %s\n'%(name))
		output = self.output1.get()
		file.write('Output %s\n'%(output))
		plot = str(self.plot1.get())
		file.write('Plot %s\n'%(plot))
		file.write('#Voltage flag\n')
		intpar = str(self.intpar1.get())
		file.write('IntPar %s\n'%(intpar))
		file.write('#Angular frenquency\n')
		doublepar = str(self.doublepar1.get())
		file.write('DoublePar %s\n'%(doublepar))
		file.write('#Voltage\n')
		complexparre= str(self.complexpar1.get())
		complexparim= str(self.complexpar2.get())
		file.write('ComplexPar %s %s\n'%(complexparre,complexparim))
		meshfile = self.meshfile1.get()
		file.write('MeshFile  %s\n'%(meshfile))
		auxfile = self.auxfile1.get()
		file.write('AuxFile  %s\n'%(auxfile))
		file.write('EOF\n')
 
		file.close()
 
 
	def run(self) :
		name=self.fichname.get()
		file = open("%s"%(name),'w')
		os.system(("C:/python24/projet/ofeli/bin/ec2d1 C:/python24/projet/%s.dat"%(name)))
 
 
 
if __name__ == '__main__':
	app = Application()
 
 
	app.mainloop()
le soucis est que ça ne m'ouvre aps le fenetre mais ça m'affiche une erreur
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
Error: 1
TypeError Exception in Tk callback
  Function: <bound method ComboBox._dropdownBtnRelease of <_Pmw.Pmw_1_3.lib.PmwComboBox.ComboBox instance at 0x015BB8A0>> (type: <type 'instancemethod'>)
  Args: (<Tkinter.Event instance at 0x016A7C38>,)
  Event type: ButtonRelease (type num: 5)
Traceback (innermost last):
  File "C:\Python24\projet\Pmw\Pmw_1_3\lib\PmwBase.py", line 1747, in __call__
    return apply(self.func, args)
  File "C:\Python24\projet\Pmw\Pmw_1_3\lib\PmwComboBox.py", line 344, in _dropdownBtnRelease
    self._selectCmd()
  File "C:\Python24\projet\Pmw\Pmw_1_3\lib\PmwComboBox.py", line 276, in _selectCmd
    return cmd(item)
TypeError: change() takes no arguments (1 given)
 
================================================
  Event contents:
    char: ??
    delta: 0
    height: ??
    keycode: ??
    keysym: ??
    keysym_num: ??
je ne comprends pas pourquoi, dc aidez moi svp, c'est vraiment urgent.