wxPython FileDialog, select folder

farsheed rodmena.com at gmail.com
Thu Dec 20 17:20:35 EST 2007


import wx
def dirchoose():
	'Gives the user selected path. Use: dirchoose()'
	global _selectedDir , _userCancel               #you should define
them before
	userPath = 'c:/'
	app = wx.App()
	dialog = wx.DirDialog(None, "Please choose your project directory:",\
			      style=1 ,defaultPath=userPath, pos = (10,10))
	if dialog.ShowModal() == wx.ID_OK:
		_selectedDir = dialog.GetPath()
		return _selectedDir
	else:
		#app.Close()
	dialog.Destroy()
	return _userCancel

Cheers, Farsheed.



More information about the Python-list mailing list