hildon.ColorButton
A widget to open a hildon.ColorSelector.
Description
hildon.ColorButton is a widget to open hildon.ColorSelector. The color field in the
button shows the selected color. The current color is set as a property to the button. The property name is
"color" and it's type is gtk.gdk.Color.
Ancestry
Up to the first non-hildon ancestor:
...
+-- gtk.Button
+-- hildon.ColorButton
Usage Example
import gtk
import hildon
def color_changed(widget, label):
color = widget.get_color()
label.set_text("Current color is: (red=%s, green=%s, blue=%s, pixel=%s)" %
(color.red, color.green, color.blue, color.pixel))
window = hildon.Window()
window.set_title("Test App")
label = gtk.Label()
button = hildon.ColorButton()
button.connect("clicked", color_changed, label)
color_changed (button, label) #Init label text
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 |
|---|
Constructor
Creates a new color button. This returns a widget in the form of a small button containing a swatch representing the current selected color. When the button is clicked, a color-selection dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.
hildon.ColorButton()
|
|
|---|---|
| Returns | A new color button. |
Methods
get_color
Gets a color from the button.
hildon.ColorButton.get_color()
|
|
|---|---|
| Returns | The color set to the button. |
set_color
Sets a color to the button.
hildon.ColorButton.set_color(color)
|
|
|---|---|
color |
A color to be set. |
Improve this page
