Bonjour,
J'ai un problème si je rempli dynamiquement le libellé d'un bouton à la création. Il n'affiche rien s'il y a un espace et retire tout les caractères spéciaux.
Pourtant le libellé du bouton doit être un string et l’élément de ma liste est bien un string, un print de l'élément de ma liste me donne le nom de fichier correctement.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 stringfichier=os.listdir("c:/repertoire") class maclasse: def __init__(self): mainwindow = gtk.Window() bouton=[] vbox = gtk.VBox() for i in range(len(stringfichier)): label = stringfichier[i] bouton.append(gtk.Button(label)) bouton[i].connect("clicked", self.openlink, i) vbox.pack_start(bouton[i]) mainwindow.add(vbox) mainwindow.show_all() mainwindow.maximize()