Hi
Here's a python Entry handling code example.
I doubt it's perfect, yet it could be of help.
Regards,
Florent
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# clutter.Entry usage example
# Copyright (C) 2008 Florent Thiery <[EMAIL PROTECTED]>
# Released under the terms of the LGPL
#
# This example demonstrates basic Entry handling with pyclutter
# Usage: click on the Entry box to activate the Entry widget, type to write text
# and hit <return> for Entry buffer console print
import clutter
class EntryWidget (clutter.Entry):
def __init__(self, stage):
clutter.Entry.__init__(self)
self.set_color(clutter.color_parse('Black'))
self.set_position(10,10)
self.set_visibility(True)
self.set_reactive(True)
self.connect("button-press-event", self.on_press_cb)
self.active = False
self.stage = stage
def key_cb(self, stage, event):
print "key_cb called"
self.handle_key_event(event)
def activated_cb(self, stage):
print "Entered text was: "+self.get_text()
def on_press_cb(self, stage, event):
if self.active == False:
self.stage.connect('key-press-event', self.key_cb)
self.connect('activate', self.activated_cb)
self.active = True
print "Focus on"
else:
self.stage.disconnect_by_func(self.key_cb)
self.disconnect_by_func(self.activated_cb)
self.active = False
print "Focus off"
if __name__ == '__main__':
stage = clutter.Stage()
stage.set_color(clutter.Color(0xcc, 0xcc, 0xcc, 0xff))
stage.set_size(320,240)
entry_test = EntryWidget(stage)
stage.add(entry_test)
stage.show_all()
clutter.main()