Created
March 8, 2024 07:56
-
-
Save jtornero/54b1586e892fdc38c1b0cb579fc86d87 to your computer and use it in GitHub Desktop.
Escogiendo un directorio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
suponemos que boton es el boton :) y nombreDirectorio el QLineEdit | |
self.boton.clicked.connect(self.escogeDirectorio) | |
def escogeDirectorio(self): | |
dir = QFileDialog.getExistingDirectory(self, tr("Directorio de imágenes"), | |
"/home", | |
QFileDialog.ShowDirsOnly | |
| QFileDialog.DontResolveSymlinks) | |
dir.exec() | |
self.nombreDirectorio.setText(dir) | |
Luego para recuperar el nombre de la carpeta pues ya lo haces con nombre=self.nombreDirectorio.text() | |
Tendrás que implementar algunos controles, naturalmente: Que canceles la apertura, etc. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment