我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用gi.repository.Gtk.Arrow()。
def __init__(self, default_value): Gtk.Box.__init__(self) self.m_value = mpd.notename_to_int(default_value) self.g_entry = Gtk.Entry() self.g_entry.set_editable(False) self.g_entry.set_text(mpd.int_to_user_octave_notename(self.m_value)) self.pack_start(self.g_entry, False, False, 0) # up eb1 = Gtk.Button() eb1.add(Gtk.Arrow(Gtk.ArrowType.UP, Gtk.ShadowType.OUT)) eb1.connect('button-press-event', self.on_up_press) eb1.connect('button-release-event', self.on_up_release) self.pack_start(eb1, True, True, 0) # down eb2 = Gtk.Button() eb2.add(Gtk.Arrow(Gtk.ArrowType.DOWN, Gtk.ShadowType.IN)) eb2.connect('button-press-event', self.on_down_press) eb2.connect('button-release-event', self.on_down_release) self.pack_start(eb2, True, True, 0) self.m_timeout = None
def __on_right_arrow_clicked(self, button): """ Handles Right Arrow clicked navigation event, moves one chapter to the right :param button: """ self.__window.load_chapter(self.__window.content_provider.current_chapter + 1)
def __on_left_arrow_clicked(self, button): """ Handles Left Arrow clicked navigation event, moves one chapter to the left :param button: """ self.__window.load_chapter(self.__window.content_provider.current_chapter - 1)
def __init__(self, text, menu): GObject.GObject.__init__(self) self.menu = menu hbox1 = Gtk.HBox() hbox2 = Gtk.HBox() icon = Gtk.Image() icon.set_from_file(datafile_path('bokken-small.svg')) hbox1.pack_start(icon, True, True, 3) label = Gtk.Label() label.set_markup("<b>"+ text + "</b>") hbox1.pack_start(label, True, True, 3) arrow = Gtk.Arrow(Gtk.ArrowType.DOWN, Gtk.ShadowType.IN) hbox1.pack_start(arrow, False, False, 3) hbox2.pack_start(hbox1, True, True, 0) # MEOW Text settings #attrs = Pango.AttrList() #attrs.change(Pango.AttrWeight(Pango.Weight.SEMIBOLD, 0, -1)) #label.set_attributes(attrs) self.add(hbox2) self.set_relief(Gtk.ReliefStyle.NORMAL) self.set_can_focus(True) self.set_can_default(False) self.connect("toggled", self.on_toggled) for sig in "selection-done", "deactivate", "cancel": menu.connect(sig, self.on_menu_dismiss)