Sorry, every time i finish writing an email which has codes in, the indentation
no problem, but when i send it, i found it becomes a mess....
so i have to send it again
Hi, All,
first thanks the people who gave helps to me,
now i encountered another question...
my first program LionCalculator, works ok on Windows, but there is a
problem on Ubuntu.
LionCalculator has a function that can store the previous calculation
results to the gtk.ListStore.
when pressing F1--F12 or clicking the gtk.CellRendererRadio, the gtk.Entry
will get the corresbonding values stored in ListStore.
when i run the program on Windows, no problem, i can see everything that
should display on the screen. but when i run it on Ubuntu, i can't see
the "F1" -- "F12" in the ListStore, can't see the calculation results
that should also display on ListStore, only the gtk.CellRendererRadio
showed. i don't understand...
and when i add "print ...get_store()[0][0]" and run it again, it print
"F1"! strange... and when i press F1 or F2..., the result will copy to
the entry, although it does not display in the TreeView, strange...
the following are codes:
#in class ResultsView......
def make_view(self):
# make ListStore for storing results
self.results_store = gtk.ListStore(gobject.TYPE_STRING,
gobject.TYPE_BOOLEAN,
gobject.TYPE_STRING)
#to store 12 calculation results, "F1"--"F2" will show
#in the 1st column
for i in xrange(12):
self.results_store.append(["F%d" % (i+1), None, None])
self.results_view = gtk.TreeView(self.results_store)
#f_renderer is for "F1" -- "F12"
f_renderer = gtk.CellRendererText()
f_renderer.set_property( 'editable', False )
f_renderer.set_property("size", 5)
f_renderer.set_property("cell-background", "cyan")
#when clicked bt_renderer, it will copy the
#corresbonding values to gtk.Entry
bt_renderer = gtk.CellRendererToggle()
bt_renderer.set_property('activatable', True)
bt_renderer.set_property("radio", True)
bt_renderer.set_property("cell-background", "grey")
bt_renderer.connect("toggled", self.ready_cp, self.results_store)
#txt_renderer is for storing calculation results
txt_renderer = gtk.CellRendererText()
txt_renderer.set_property( 'editable', False )
txt_renderer.set_property("size", 5)
txt_renderer.set_property("cell-background", "green")
#i guess the problem is in the following, but i don't know where it
#exactly is, ok in Windows, can't show in Ubuntu...
bt_column = gtk.TreeViewColumn("F1--F12")
bt_column.pack_start(f_renderer, True)
bt_column.pack_start(bt_renderer, False)
bt_column.set_attributes(f_renderer, text=0)
bt_column.add_attribute(bt_renderer, "active", 1)
txt_column = gtk.TreeViewColumn("Calculation Results ",
txt_renderer,
text=2)
self.results_view.append_column(bt_column)
self.results_view.append_column(txt_column)
self.results_view.show()
return self.results_view
#in class LionCalc....
def __init__(self):
......
self.results_view = ResultsView()
right_vbox.pack_start(self.results_view.make_view(), True, True, 0)
win.show_all()
could anybody give me help? thanks.
--
Lion Chen
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/