|
|
2011-02-02
, 21:22
|
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#2
|
|
|
2011-02-02
, 22:24
|
|
Posts: 5 |
Thanked: 0 times |
Joined on Jul 2010
@ Paris, France
|
#3
|
I am trying to design a user interface with Python, based on hildon and gtk GUI packages of the Maemo 5 OS.
I would like to design a dialog with elements contained in a scrollable area, but I did not yet manage to achieve my purpose.
An existing example of a scrollable dialog can be found in the calendar app of the Maemo 5 OS. When creating or updating an "event", a dialog is displayed with a scrollable area where the date and hour of the event can be set, with the name and the place of the event, et caetera... You should be familiar with this dialog, aren't you?
What I did (without success) was:
- the creation of a dialog (gtk.Dialog),
- the assignment of a pannable area to the vbox of the dialog
- the addition of all GUI elements to this pannable area instead of the dialog's vbox
With this, nothing is displayed in the dialog. Please find a snippet of my code below.
import urllib import urllib2 import gtk import hildon class MyDialog(gtk.Dialog): def __init__(self,parent): # Init of the dialog with an OK button gtk.Dialog.__init__(self,'Title',parent,gtk.DIALOG_MODAL,(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) # Init of a pannable area pann = hildon.PannableArea() # add it to the dialog vbox self.vbox.add(pann) # insertion of a picker button self.pb1 = hildon.PickerButton(gtk.HILDON_SIZE_FINGER_HEIGHT,hildon.BUTTON_ARRANGEMENT_VERTICAL) self.pb1.set_title('PButton 1') self.pb1.show() pann.add_with_viewport(self.pb1) # init of the selector of this Picker Button self.pb1_sel = hildon.TouchSelector(text = True) self.pb1_sel.append_text('Elt 1') self.pb1_sel.append_text('Elt 2') self.pb1_sel.append_text('Elt 3') self.pb1.set_selector(self.pb1_sel) # insertion of an input field self.input1 = hildon.Entry(gtk.HILDON_SIZE_AUTO) self.input1.show() pann.add_with_viewport(self.input1) # insertion of a picker button self.pb2 = hildon.PickerButton(gtk.HILDON_SIZE_FINGER_HEIGHT,hildon.BUTTON_ARRANGEMENT_VERTICAL) self.pb2.set_title('Title 2') self.pb2.show() pann.add_with_viewport(self.pb2) # init of the selector of this Picker Button self.pb2_sel = hildon.TouchSelector(text = True) self.pb2_sel.append_text('Elt 1') self.pb2_sel.append_text('Elt 2') self.pb2_sel.append_text('Elt 3') self.pb2.set_selector(self.pb2_sel) # insertion of an input field self.input2 = hildon.Entry(gtk.HILDON_SIZE_AUTO) self.input2.show() pann.add_with_viewport(self.input2) # insertion of a picker button self.pb3 = hildon.PickerButton(gtk.HILDON_SIZE_FINGER_HEIGHT,hildon.BUTTON_ARRANGEMENT_VERTICAL) self.pb3.set_title('Title 3') self.pb3.show() pann.add_with_viewport(self.pb3) # init of the selector of this Picker Button self.pb3_sel = hildon.TouchSelector(text = True) self.pb3_sel.append_text('Elt 1') self.pb3_sel.append_text('Elt 2') self.pb3_sel.append_text('Elt 3') self.pb3.set_selector(self.pb3_sel) # insertion of a picker button self.pb4 = hildon.PickerButton(gtk.HILDON_SIZE_FINGER_HEIGHT,hildon.BUTTON_ARRANGEMENT_VERTICAL) self.pb4.set_title('Title 4') self.pb4.show() pann.add_with_viewport(self.pb4) # init of the selector of this Picker Button self.pb4_sel = hildon.TouchSelector(text = True) self.pb4_sel.append_text('Elt 1') self.pb4_sel.append_text('Elt 2') self.pb4_sel.append_text('Elt 3') self.pb4.set_selector(self.pb4_sel) # insertion of a picker button self.pb5 = hildon.PickerButton(gtk.HILDON_SIZE_FINGER_HEIGHT,hildon.BUTTON_ARRANGEMENT_VERTICAL) self.pb5.set_title('Title 5') self.pb5.show() pann.add_with_viewport(self.pb5) # init of the selector of this Picker Button self.pb5_sel = hildon.TouchSelector(text = True) self.pb5_sel.append_text('Elt 1') self.pb5_sel.append_text('Elt 2') self.pb5.set_selector(self.pb5_sel) # display of the dialog dialog = MyDialog(None) res = dialog.run() dialog.destroy()Can you help me please?
Kind regards
Valentin900