コード例 #1
0
from gi.repository import Gtk

from sugar3.graphics import animator
from sugar3.graphics.icon import Icon
from sugar3.graphics import style

from common import set_theme

set_theme()


class _Animation(animator.Animation):
    def __init__(self, icon, start_size, end_size):
        animator.Animation.__init__(self, 0.0, 1.0)

        self._icon = icon
        self.start_size = start_size
        self.end_size = end_size

    def next_frame(self, current):
        d = (self.end_size - self.start_size) * current
        self._icon.props.pixel_size = int(self.start_size + d)


def __animation_completed_cb(anim):
    print "Animation completed"


w = Gtk.Window()
w.connect("delete-event", Gtk.main_quit)
コード例 #2
0
from gi.repository import Gtk

from sugar3.graphics import iconentry
from common import set_theme
set_theme()


def __go_next_cb(entry, icon_pos, data=None):
    print 'Go next'


def __entry_activate_cb(widget, data=None):
    print 'Entry activate'


w = Gtk.Window()
w.connect("delete-event", Gtk.main_quit)

box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
w.add(box)

entry = iconentry.IconEntry()
entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY, 'go-next')
entry.connect('icon-press', __go_next_cb)
entry.connect('activate', __entry_activate_cb)
entry.set_progress_fraction(0.3)
box.pack_start(entry, False, False, 0)

w.show_all()

Gtk.main()