<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Help please!<br>
<br>
I am slowly learning OOP-style PyGTK code, and have recently discovered
how 'nasty' gtk.Spinbutton looks on Maemo :(<br>
<br>
OK, so I was just going to make some quick changed to my Python code to
use 'hildon.NumberEditor' instead, but it is not as much a
'drop-in-replacement' as a newbie like me requires...<br>
<br>
<font color="#3333ff">""" subclass the gtk.Digalog() class to create a
new dialog window """<br>
class spin_window(gtk.Dialog) : <br>
value = [0] * SPIN_BUTTON_COUNT<br>
<br>
<font color="#009900"> def hildon_set_value(self,widget,index):<br>
self.value[index] = widget.get_value()<br>
return</font><br>
<br>
# a callback to remember the values of the spin buttons.<br>
# the 'index' is setup when connecting the callback<br>
def set_value(self,widget,index):<br>
self.value[index] = widget.get_value_as_int()<br>
return<br>
<br>
def __init__(self,window):<br>
# init the parent class to create the dialog<br>
super(spin_window, self).__init__("set spin values",
window,<br>
gtk.DIALOG_DESTROY_WITH_PARENT |
gtk.DIALOG_MODAL,<br>
(gtk.STOCK_OK, gtk.RESPONSE_OK))<br>
<br>
<font color="#009900"> number_editor =
hildon.NumberEditor(-90,90)<br>
#number_editor.connect("changed",self.set_value, 0)<br>
#number_editor.connect("notify::value",self.set_value,
0)<br>
number_editor.connect("notify::value",self.hildon_set_value,0)<br>
number_editor.set_value(0)<br>
self.vbox.pack_start(number_editor)<br>
self.value[0] = 0<br>
number_editor.show()</font><br>
<br>
label = gtk.Label('Latitude Degrees:')<br>
self.vbox.pack_start(label)<br>
#label.modify_font(pango.FontDescription("sans 30"))<br>
label.show()<br>
<br>
adjustment = gtk.Adjustment(0, -90, 90, 1, 1, 1)<br>
spinbutton = gtk.SpinButton(adjustment,0,0)<br>
spinbutton.connect("changed",self.set_value, 1)<br>
self.vbox.pack_start(spinbutton)<br>
self.value[1] = 0<br>
spinbutton.show()<br>
...</font><br>
<br>
Notice my feeble attempts to add 'special' code for the numbereditor --
but the code above does not work:<br>
<br>
<font color="#ff0000">"TypeError: hildon_set_value() takes exactly 3
arguments (4 given)"</font><br>
<br>
So I am getting all confused! It *looks* like I am using the correct
signal value, and passing three parameters...<br>
<br>
There are very few Python examples out on Google for me to learn the
solution with.<br>
<br>
Thanks<br>
<br>
Dare<br>
</body>
</html>