Pyglade, gtk, howto write more efficiently, and waste less code?
niemand.leermann at thomas-guettler.de
niemand.leermann at thomas-guettler.de
Tue Sep 19 10:59:20 EDT 2006
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
More information about the Python-list
mailing list