Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 02:10, 3 May 2008.

Widgets Hildon em Python - Parte 1

From Forum Nokia Wiki

O framework Hildon provê um conjunto considerável de widgets. O seguinte código possui uma função de chamada que é invocada toda vez que o botão é clicado e gera o evento "clicked". Para disponibilizar cada widget Hildon na tela, basta substituir o corpo do método button_callback pelo código-exemplo.

import gtk
import hildon

class HelloWorldApp(hildon.Program):
def __init__(self):
   hildon.Program.__init__(self)

   self.window = hildon.Window()
   self.window.connect("delete_event", self.quit)
   self.add_window(self.window)

   button = gtk.Button("Clique Aqui!")
   self.window.add(button)
   button.connect("clicked", self.button_callback, self.window)
   button.show()

def quit(self, *args):
   gtk.main_quit()

def button_callback(widget, button, window):
   #PERFORM YOUR ACTION HERE
   print "Callback function"

def run(self):
   self.window.show_all()
   gtk.main()

if __name__ == "__main__":
   app = HelloWorldApp()
   app.run()


hildon.CalendarPopup

Um hildon.CalendarPopup é um diálogo que contém um GtkCalendar. Também possui botões para escolha do mês/ano.

Um hildon.CalendarPopup

def button_callback(widget, button, window):	
   dialog = hildon.CalendarPopup(window, 2008, 04, 29)
   dialog.run()
   date_tuple = dialog.get_date()
   dialog.destroy()

hildon.FontSelectionDialog

Permite que o usuário escolha uma fonte diferente para o texto selecionado e modifique os seus atributos, tais como família, tamanho, cor, etc.

Um hildon.FontSelectionDialog

def button_callback(widget, button, window):
   fontDialog = hildon.FontSelectionDialog(window, "Choose a font...")
   fontDialog.set_preview_text ("Hildon Widgets")
   fontDialog.run()
   fontDialog.hide()

hildon.GetPasswordDialog

Este diálogo provê um campo de texto para entrada de senha.

Um hildon.GetPasswordDialog

def button_callback(widget, button, window):
   passwordDialog = hildon.GetPasswordDialog(window, True)
   passwordDialog.set_property("Senha", "")
   response = passwordDialog.run()
   passwordDialog.hide() 
   if response == gtk.RESPONSE_OK:
        print passwordDialog.get_password()
Related Discussions
Thread Thread Starter Forum Replies Last Post
Mobile Python Book is out hartti Python 10 2007-11-19 12:26
Help! Loading self written DLL and in S60 Python alviskoon Python 3 2006-12-13 10:45
Python versus Java mogmios Python 1 2006-03-05 19:33
help please about python SDK ummair Python 1 2006-07-03 16:33
Tab Control srkreddy999 Mobile Java Media (Graphics & Sounds) 1 2006-01-16 21:55
 
Powered by MediaWiki