Bonjour,
j'essaie de faire un ping en cliquant sur un bouton comme suit:
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
                ping=gtk.Button("PING")
         	ping.connect("clicked", self.Ping_wiener, None)
       def Ping_wiener(self, widget, data):
  		window=gtk.Window(gtk.WINDOW_TOPLEVEL
  		window.set_default_size(500,250)
  		window.set_position(gtk.WIN_POS_CENTER)
  		window.set_border_width(5)
  		window.connect("destroy", self.detruire, None)
  		vbox= gtk.VBox(False, 10) 
  		window.add(vbox)
 
		textview = gtk.TextView()
		textview.set_cursor_visible(False)
		textview.set_wrap_mode(gtk.WRAP_CHAR)
		buffertexte = textview.get_buffer()
		lPing=os.popen('ping -c 4 192.168.124.128','r')
		sLigne = lPing.readlines()	
		buffertexte.set_text(sLigne)
		vbox.pack_start(textview, False, False, 0)	
		bouton = gtk.Button("Fermer")
		bouton.connect("clicked", self.detruire, None)
		vbox.pack_start(bouton, False, False, 0)
 
	  	window.show_all()
 
  		gtk.main()
mon but est d'afficher dans le textview le résultat de ping ligne par ligne comme on le voit souvent sur la console.
mais la, il m'affiche une erreur disant que:
TypeError: GtkTextBuffer.set_text() argument 1 must be string or read-only buffer, not list
pourriez vous m'aider ??
Merci.