hi everyone:

i got this problem that i don't know how to solve it. i'm doing a little
calculator. It consists of 4 gtk.Entry to get the input and about 16
gtk.Entry to for displaying(outputs) the results.

right know i'm testing using only 2 input entries and a clicking on a 
button to get the result on one output entry. making a just an addition
as a test of it.

-----------------------------------------------------------------------------------------------------
dict = {}
class calc:
    def button_clicked(self, widget, data=None):
        if data == "open":
            file_sel = self.open_file()
            file_sel
        elif data == "save":
            file_sel = self.save_file()
            file_sel
        else:
            dict['mbh'] = dict['t1'] + dict['t2']
            dict['mbh1'] = repr(dict['mbh'])
            print dict
        return

QUOTE: the else part, is for the calculate button, when is clicked.
        
     def text_output(self, type):
         entry = gtk.Entry(5)
         entry.set_max_length(20)
         entry.set_width_chars(5)
         entry.set_editable(False)
         entry.set_text('')
         if dict == None:
         dict[type] = entry.set_data('value', '')
         else:
             entry.set_data('value', dict[type])
         #value = self.value(type)
         #entry.set_text('%s' % value)
         entry.show()
        return entry

    def output_box(self, type):
        entry = self.text_output()
        box = gtk.HBox(False, 0)
        box.pack_start(entry, True, False, 0)
        box.show()
        return box
-----------------------------------------------------------------------------------------------------

then all after this, there is the calculator layout which is made using 
more def's. and inside one of those def's is when i call the 
self.text_output.

-----------------------------------------------------------------------------------------------------
    def notebook1(self):
        #Calls for previous definitions
        buttons = self.buttons
        text_input = self.text_input
        text_output = self.text_output
        compensation = self.combo
        images = self.images()
(....)
        dpmc3_1.attach(text_output('mbh1'), 1, 2, 1, 2)
-----------------------------------------------------------------------------------------------------

the string 'mbh1' (according to my logic) is to identify the entry box that
is going to contain the result. so i add it as a key to the dictionary and
store the result there. and trying to using it as key to refresh the entry
that should contain the result.

so right now i know that the result is stored in the dictionary (and indeed 
it is) on the corresponding key, but how can i refresh the entry itself to 
display it??

should i need to change the text_output to the gtk.main loop? or any 
better suggestion?

thanks guys



      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to