Re: Pyglade, gtk, howto write more efficiently, and waste less code?

2006-09-20 Thread Pipiten
Thanks thomas!, i did it that way ;).

maybe someone can help me with this, it seems simple, but i don`t know
how to do it.

I have:
self.paths = [,path1,path2,path3,path4,path5]
self.paths[1] = self.wTree.get_widget(path1)
self.paths[2] = self.wTree.get_widget(path2)
self.paths[3] = self.wTree.get_widget(path3)
self.paths[4] = self.wTree.get_widget(path4)
self.paths[5] = self.wTree.get_widget(path5)

what about if i have 30 widgets? how can i get them all?

.. variables variables?  ¬¬



thanks everybody, good luck

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pyglade, gtk, howto write more efficiently, and waste less code?

2006-09-20 Thread Gabriel Genellina

At Wednesday 20/9/2006 10:06, Pipiten wrote:


I have:
self.paths = [,path1,path2,path3,path4,path5]
self.paths[1] = self.wTree.get_widget(path1)
self.paths[2] = self.wTree.get_widget(path2)
self.paths[3] = self.wTree.get_widget(path3)
self.paths[4] = self.wTree.get_widget(path4)
self.paths[5] = self.wTree.get_widget(path5)

what about if i have 30 widgets? how can i get them all?


Is this what you want?

for i,path in enumerate(self.paths):
  self.paths[i] = self.wTree.get_widget(path)



Gabriel Genellina
Softlab SRL 






__
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Pyglade, gtk, howto write more efficiently, and waste less code?

2006-09-19 Thread [EMAIL PROTECTED]
Pipiten wrote:

 Hi everybody, i` m new in this group, and python so.., my greetings to
 everybody here.
 I wrote a little program, in wich i do this:
 (I have several Select File buttons, one for each file (in this case,
 an image) wich has an text_entry, so i can add a comment for each
 picture.)

 def on_button1_clicked(self,widget):
  Button 1 pressed
  image_file1 = FileSelection(self)
  self.path1.set_text(image_file1)
  self.image1.set_from_file(image_file1)
  self.image1.show()
 ...

You can connect all buttons to the same callback,
and in the callback you pick they matching image.

At least that what I would do (Up to now I don't use glade).

 HTH,
  Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list