bonjour,
jai un bouton qui permet de selectionner un repertoire je veux utliser le path dans la fonction d'un autre boutton mais je ne sait pas comment ??
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
 
import wx
import os
class maissa(wx.Frame):
	def __init__(self,parent,id):
		self.path1=""
		wx.Frame.__init__(self,parent,id,"la fenetre dessai",size=(300,300))
		panel=wx.Panel(self)
		boutton1=wx.Button(panel,label="ouvrir",pos=(130,10),size=(60,60))
		boutton2=wx.Button(panel,label="afficher",pos=(30,10),size=(60,60))
		self.Bind(wx.EVT_BUTTON,self.opendir,boutton1)
		self.Bind(wx.EVT_BUTTON,self.essai,boutton2)
 
	def opendir(self, event):
		dlg = wx.DirDialog(self, "Choose a directory:", style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON)
		if dlg.ShowModal() == wx.ID_OK:
			path=dlg.GetPath()
		opendir.Destroy()
 
	def essai(self,event):
		print path1
if __name__=='__main__':
	app=wx.PySimpleApp()
	frame=maissa(parent=None,id=-1)
	frame.Show()
	app.MainLoop()