[maemo-developers] ColorSelectionDialog in Python

From: Daniel Martín Yerga dyerga at gmail.com
Date: Sat Aug 4 12:55:38 EEST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

On Sat, 4 Aug 2007 00:54:26 -0400
"Tony Maro" <tony at maro.net> wrote:

> I can't for the life of me figure out how to use the ColorChooserDialog in
> Python.
> 
> I try to call it the same way I do hildon.FileChooserDialog, but when I use
> hildon.ColorChooserDialog all I get is:
> 'module' object has no attribute 'ColorChooserDialog'

Try with hildon.ColorSelector

> Yes, my file includes "hildon".
> 
> I also can't find any examples other than the main API entry for it.  Any
> suggestions?

An example like I use it in maemo wordpy:

def on_text_color_clicked(self, widget):
  #self.wndMain is a hildon.Window
  color_selector = hildon.ColorSelector(self.wndMain)  
  result = color_selector.run() 
  if (result==gtk.RESPONSE_OK):
    #get color selected
    text_color = color_selector.get_color() 
    #change color selected to a hex string
    colorstring = gtk.color_selection_palette_to_string([text_color])

    <more code>

  color_selector.destroy() 


Cheers.
- -- 
Daniel Martín Yerga
dyerga(arroba)gmail.com
GNU/Linux user #372827
http://yerga.freehostia.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGtE0jcnvB1T3xmfMRAnTUAJ99jXj5HLSZnfyWKQGrcpvBaO6ICwCfQOBb
EDHzhbV3s4F9UlmTZJ+BQog=
=GPlF
-----END PGP SIGNATURE-----
More information about the maemo-developers mailing list