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()
def on_button2_clicked(self,widget):
"""Button 2 pressed"""
image_file2 = FileSelection(self)
self.path2.set_text(image_file2)
self.image2.set_from_file(image_file2)
self.image2.show()
def on_button3_clicked(self,widget):
"""Button 3 pressed"""
image_file3 = FileSelection(self)
self.path3.set_text(image_file3)
self.image3.set_from_file(image_file3)
self.image3.show()
def on_button4_clicked(self,widget):
"""Button 4 pressed"""
image_file4 = FileSelection(self)
self.path4.set_text(image_file4)
self.image4.set_from_file(image_file4)
self.image4.show()
def on_button5_clicked(self,widget):
"""Output dir button pressed"""
outputpath = FileSelection(self)
self.path5.set_text(outputpath)
Is there any way to do this, with a for bucle, or something like that?.
For example, if i want to to the same, 25 times, not to copy and paste.
Does anyone knows how to do that?, write it one time, and flexible to
use many times.
( I think it should be with the variables sent by parameters, isn´t? )
Thanks a lot, have a nice day! 3 3062
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Logan |
last post by:
Several people asked me for the following HOWTO, so I decided to
post it here (though it is still very 'alpha' and might contain
many (?) mistakes; didn't test what I wrote, but wrote it - more
or...
|
by: Jon Slaughter |
last post by:
I'm trying to replace some bytes in a file using fstream but all I seem to
be able to do is append or 0 the file then write... Basicaly I just need to
replace the first 512 bytes of the file with...
|
by: jacob navia |
last post by:
In C, we have read-only memory (const), read/write memory
(normal data), and write only memory.
Let's look at the third one in more detail.
Write only memory is a piece of RAM that can only...
|
by: eyh5 |
last post by:
Hi,
I'm writing some C codes to run simulations.
I'm wondering if there is a website that may contain useful information
on how to make one's code run more efficiently and in a...
|
by: Ray Dukes |
last post by:
What I am looking to do is map the implementation of interface
properties and functions to an inherited method of the base class.
Please see below.
...
|
by: Andrea |
last post by:
Hi there -
I'm hoping someone can help me; I've been struggling with this for a
few days! :-)
I have a webpage that is comprised of many forms containing questions.
As the user answers one...
|
by: Ancient_Hacker |
last post by:
It sure would be nice if I could have a macro that add a level of
indirection to its argument.
So if I write: AddIndirection( X )
The macro AddIndirection will do: #define X (*X)
...
|
by: webrod |
last post by:
Hi,
I have some php pages with a lot of HTML code.
I am looking for a HTML validator tool (like TIDY).
TIDY is not good enough with PHP tags (it removes a lot of php code).
Do you have any...
|
by: perry.yuan |
last post by:
Hi Gurus,
I am looking for C code for multiplying 32bit by 32bit operands and
getting a 64bit product. i.e.
U32 m1, m2;
U64 p = m1 * m2;
Of course I can use
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| | |