hildon.TimePicker

hildon.TimePicker

A dialog popup widget which lets the user set a time.

Description

hildon.TimePicker is a dialog popup widget which lets the user set a time. using up/down arrows on hours and minutes. There are two arrows for minutes, so that minutes can be added also in 10min steps.

Ancestry

Up to the first non-hildon ancestor:

...
 +-- gtk.Dialog
      +-- hildon.TimePicker

Usage Example

import gtk
import hildon

def pick_time(widget, label, time_picker):
    response = time_picker.run()
    time_picker.hide()
    
    if response == gtk.RESPONSE_OK:
        label.set_text("Time is %s hours and %s minutes." % time_picker.get_time())

window = hildon.Window()
window.set_title("Test App")

label = gtk.Label("No time picked yet.")

time_picker = hildon.TimePicker(window)

button = gtk.Button("Click to pick a time")
button.connect("clicked", pick_time, label, time_picker)

vbox = gtk.VBox(False, 10)
vbox.pack_start (button)
vbox.pack_start (label)
window.add(vbox)

window.show_all()

gtk.main()
      

Properties

Name Access Description
"minutes" Read/Write The selected time in minutes since midnight.
"arrow-width" Read Increase/decrease arrows width.
"arrow-height" Read Increase/decrease arrows height.

Constructor

Hildon Time Picker shows a time picker dialog. Close button is placed in dialog's action area and time picker is placed in dialogs vbox. Actual time picker consists two gtk.Label fields, one for hours and other for minutes, arrow buttons and an AM/PM button. A ":" is placed between hours and minutes fields.

hildon.TimePicker(parent)
parent Its parent window.
Returns A new hildon.TimePicker.

Methods

get_time

Gets the time currently set in the dialog.

hildon.Class.get_time()
Returns A tuple of the form (hours, minutes), with hours being in 24h format.

set_time

Sets the time to be shown in the dialog.

hildon.Class.set_time(hours, minutes)
hours Hours in 24h format.
minutes Minutes.


Improve this page