python类Image()的实例源码

svg_widget.py 文件源码 项目:sc-controller 作者: kozec 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self,  filename, init_hilighted=True):
        Gtk.EventBox.__init__(self)
        self.cache = {}
        self.areas = []

        self.connect("motion-notify-event", self.on_mouse_moved)
        self.connect("button-press-event", self.on_mouse_click)
        self.set_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_PRESS_MASK)

        self.size_override = None
        self.image_width = 1
        self.image_height = 1
        self.set_image(filename)
        self.image = Gtk.Image()
        if init_hilighted:
            self.hilight({})
        self.add(self.image)
        self.show_all()
abstract.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def add_module_is_deprecated_label(self):
        """
        The deprecated module must set a message in self.g_deprecated_label
        in on_start_practise, preferable telling the file name of the
        lesson file.
        """
        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_DIALOG_WARNING,
                           Gtk.IconSize.BUTTON)
        hbox = Gtk.HBox()
        hbox.set_border_width(12)
        self.practise_box.set_child_packing(self.g_lesson_heading, False, False, 0, 0)
        hbox.set_spacing(6)
        hbox.pack_start(img, True, True, 0)
        self.g_deprecated_label = Gtk.Label()
        hbox.pack_start(self.g_deprecated_label, True, True, 0)
        self.practise_box.pack_start(hbox, False, False, 0)
        self.practise_box.reorder_child(hbox, 0)
rightnotebook.py 文件源码 项目:bokken 作者: thestr4ng3r 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def create_tab(self, title, tab_child, icon=''):
        tab_box = Gtk.HBox(False, 3)
        close_button = Gtk.Button()

        image = Gtk.Image()
        image.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)

        label = Gtk.Label(label=title)
        if icon:
            i = Gtk.Image()
            i.set_from_stock(eval('Gtk.STOCK_' + icon), Gtk.IconSize.MENU)
            tab_box.pack_start(i, False, False, 0)

        close_button.connect("clicked", self.close_tab, tab_child)
        close_button.set_image(image)
        close_button.set_relief(Gtk.ReliefStyle.NONE)
        tab_box.pack_start(label, True, True, 0)
        tab_box.pack_end(close_button, False, False, 0)

        tab_box.show_all()
        if title in ['Loading dasm...', 'Code', 'Callgraph', 'Flowgraph', 'Interactive', 'Strings', "Sections", 'Hexdump', 'Bindiff', 'File info']:
            close_button.hide()

        return tab_box
dialog.py 文件源码 项目:apart-gtk 作者: alexheretic 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, root: Gtk.Window, text: str,
                 ok_button_text: str = Gtk.STOCK_OK,
                 cancel_button_text: str = Gtk.STOCK_CANCEL,
                 header: str = '',
                 message_type: Gtk.MessageType = Gtk.MessageType.WARNING):
        Gtk.MessageDialog.__init__(self, root, 0, message_type=message_type)
        self.set_title(header)
        self.icon = Gtk.Image()
        self.icon.set_from_icon_name(appropriate_icon(message_type), Gtk.IconSize.LARGE_TOOLBAR)
        self.text = Gtk.Label(text)
        heading = Gtk.Box()
        heading.add(self.icon)
        heading.add(self.text)

        self.get_message_area().add(heading)
        self.get_message_area().set_spacing(0)
        self.add_button(cancel_button_text, Gtk.ResponseType.CANCEL)
        self.add_button(ok_button_text, Gtk.ResponseType.OK)
        self.show_all()
dialog.py 文件源码 项目:apart-gtk 作者: alexheretic 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, root: Gtk.Window, text: str,
                 ok_button_text: str = Gtk.STOCK_OK,
                 header: str = '',
                 message_type: Gtk.MessageType = Gtk.MessageType.ERROR):
        Gtk.MessageDialog.__init__(self, root, 0, message_type=message_type)
        self.set_title(header)
        self.icon = Gtk.Image()
        self.icon.set_from_icon_name(appropriate_icon(message_type), Gtk.IconSize.LARGE_TOOLBAR)
        self.text = Gtk.Label(text)
        heading = Gtk.Box()
        heading.add(self.icon)
        heading.add(self.text)

        self.get_message_area().add(heading)
        self.get_message_area().set_spacing(0)
        self.add_button(ok_button_text, Gtk.ResponseType.OK)
        self.show_all()
functions.py 文件源码 项目:poseidon 作者: sidus-dev 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def data2pixbuf(data, size):

    fp = Image.open(BytesIO(data))
    output = BytesIO()
    fp.thumbnail(size, Image.ANTIALIAS)
    fp.save(output, format="png")
    data = output.getvalue()
    output.close()

    loader = GdkPixbuf.PixbufLoader()
    loader.write(data)
    loader.close()
    pixbuf = loader.get_pixbuf()

    if pixbuf:
        if (pixbuf.get_width(), pixbuf.get_height()) != size: return None
        else: return pixbuf
    else: return None
icons_utils.py 文件源码 项目:nautilus-folder-icons 作者: bil-elmoussaoui 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def set_icon(self, icon_name):
        icon_name = uriparse(icon_name)
        theme = Gtk.IconTheme.get_default()
        # Make sure the icon name doesn't contain any special char
        # Be sure that the icon still exists on the system
        if (is_path(icon_name) and path.exists(icon_name)
                and get_ext(icon_name) in SUPPORTED_EXTS):
            pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(icon_name,
                                                             Image.SIZE, Image.SIZE,
                                                             True)
        elif theme.has_icon(icon_name):
            pixbuf = theme.load_icon_for_scale(icon_name, Image.SIZE, 1, 0)
        else:
            pixbuf = theme.load_icon_for_scale("image-missing",
                                               Image.SIZE, 1, 0)
        self.set_from_pixbuf(pixbuf)
main_window.py 文件源码 项目:hubangl 作者: soonum 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self):
        self.placeholder_image = Gtk.Image.new_from_icon_name(
            Gtk.STOCK_NEW, Gtk.IconSize.DIALOG)
        self.new_feed_button = Gtk.Button("New Feed")

        self.new_feed_vbox = Gtk.Box(Gtk.Orientation.VERTICAL)
        self.new_feed_vbox.set_halign(Gtk.Align.CENTER)
        self.new_feed_vbox.set_valign(Gtk.Align.CENTER)
        _pack_widgets(self.new_feed_vbox,
                      self.placeholder_image,
                      self.new_feed_button)

        self._grid = Gtk.Grid()
        self._grid.set_row_homogeneous(True)
        self._grid.set_column_homogeneous(True)
        self._grid.attach(self.new_feed_vbox, 0, 0, 1, 1)
        self._grid.attach(Gtk.Label("FEED ELEMENT DEBUG1"), 1, 0, 1, 1)  # DEBUG
        self._grid.attach(Gtk.Label("FEED ELEMENT DEBUG2"), 0, 1, 1, 1)  # DEBUG
        self._grid.attach(Gtk.Label("FEED ELEMENT DEBUG3"), 1, 1, 1, 1)  # DEBUG
        self._grid.show_all()

        self.container = self._grid
images.py 文件源码 项目:hubangl 作者: soonum 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def load_icons(self):
        """
        Load all icons used for buttons.
        """
        for icon_path in self.artwork_path.iterdir():
            for key in self.icons:
                filename = icon_path.name.lower()
                if key in filename:
                    icon = Gtk.Image()
                    icon.set_from_file(icon_path.as_posix())
                    if ("_activated_" in filename
                            and "_striked_" not in filename):
                        self.icons[key]["activated"] = icon
                    elif "_striked_" in filename:
                        self.icons[key]["striked"] = icon
                    elif "_16-16_" in filename:
                        self.icons[key]["regular_16px"] = icon
                    else:
                        self.icons[key]["regular"] = icon
images.py 文件源码 项目:hubangl 作者: soonum 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def switch_icon_version(self, icon_id, current_icon):
        """
        Switch version of ``icon``.

        :param icon_id: id of the icon

        :return: :class:`Gtk.Image` or ``None``
        """
        icon_values = self.icons.get(icon_id, None)
        if not icon_values:
            return

        if current_icon is icon_values["regular"]:
            return icon_values["activated"]
        elif current_icon is icon_values["activated"]:
            return icon_values["regular"]
symbolic_icons.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, name):
        Gtk.Image.__init__(self)

        context = self.get_style_context()
        context.add_class("symbolic-icon")

        # get base dir
        SYMBOLIC_DIR = os.path.join(
            softwarecenter.paths.datadir, "ui/gtk3/art/icons/")

        drop_shadow_path = SYMBOLIC_DIR + self.DROPSHADOW % name
        self.drop_shadow = cairo.ImageSurface.create_from_png(drop_shadow_path)
        icon_path = SYMBOLIC_DIR + self.ICON % name
        self.icon = cairo.ImageSurface.create_from_png(icon_path)

        self.drop_shadow_x_offset = 0
        self.drop_shadow_y_offset = 1

        self.connect("draw", self.on_draw, self.drop_shadow, self.icon,
                     self.drop_shadow_x_offset, self.drop_shadow_y_offset)
thumbnail.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, id_, url, cancellable, gallery):
        Gtk.Button.__init__(self)
        self.id_ = id_

        def download_complete_cb(loader, path):
            width, height = ThumbnailGallery.THUMBNAIL_SIZE_CONTRAINTS
            pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
                        path,
                        width, height,  # width, height constraints
                        True)  # respect image proportionality
            im = Gtk.Image.new_from_pixbuf(pixbuf)
            self.add(im)
            self.show_all()

        loader = SimpleFileDownloader()
        loader.connect("file-download-complete", download_complete_cb)
        loader.download_file(
            url, use_cache=ScreenshotGallery.USE_CACHING)

        self.connect("draw", self.on_draw)
thumbnail.py 文件源码 项目:x-mario-center 作者: fossasia 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, id_, url, cancellable, gallery):
        Gtk.Button.__init__(self)
        self.id_ = id_

        def download_complete_cb(loader, path):
            width, height = ThumbnailGallery.THUMBNAIL_SIZE_CONTRAINTS
            pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
                        path,
                        width, height,  # width, height constraints
                        True)  # respect image proportionality
            im = Gtk.Image.new_from_pixbuf(pixbuf)
            self.add(im)
            self.show_all()

        loader = SimpleFileDownloader()
        loader.connect("file-download-complete", download_complete_cb)
        loader.download_file(
            url, use_cache=ScreenshotGallery.USE_CACHING)

        self.connect("draw", self.on_draw)
indicator.py 文件源码 项目:batterym 作者: maks-a 项目源码 文件源码 阅读 50 收藏 0 点赞 0 评论 0
def battery_monitor(self, _):
        if self.window is None:
            self.window = gtk.Window()
            self.window.connect('delete-event', self.close_window)
            self.window.set_title('Battery Monitor')
            self.window.set_border_width(10)
            self.window.set_size_request(700, 500)
            self.window.set_resizable(False)
            self.window.set_position(gtk.WindowPosition.CENTER)
            self.window.set_icon_from_file(BATTERY_MONITOR_ICON)
            self.window.vbox = gtk.Box()
            self.window.vbox.set_spacing(5)
            self.window.vbox.set_orientation(gtk.Orientation.VERTICAL)
            self.window.add(self.window.vbox)
            self.image = gtk.Image()
            self.image.set_from_file(CAPACITY_HISTORY_CHART)
            self.window.vbox.pack_start(self.image, False, False, 0)
        if not self.window.props.visible:
            self.window.show_all()
games_nebula.py 文件源码 项目:games_nebula 作者: yancharkin 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def create_loading_window(self):

        self.loading_window = Gtk.Window(
            title = "Games Nebula",
            icon = app_icon,
            type = Gtk.WindowType.POPUP,
            window_position = Gtk.WindowPosition.CENTER_ALWAYS,
            resizable = False
            )

        self.box_loading_window = Gtk.Box()

        loading_icon = app_icon.scale_simple(32, 32, InterpType.BILINEAR)

        self.image_loading = Gtk.Image(
            pixbuf = loading_icon,
            margin_left = 10,
            margin_right = 10
            )

        self.label_loading = Gtk.Label(
            label = _("Launching 'Games Nebula'"),
            margin_right = 10,
            margin_left = 10,
            margin_top = 20,
            margin_bottom = 20
            )

        self.box_loading_window.pack_start(self.image_loading, True, True, 0)
        self.box_loading_window.pack_start(self.label_loading, True, True, 0)
        self.loading_window.add(self.box_loading_window)
        self.loading_window.show_all()
mooncalendarwindow.py 文件源码 项目:my-weather-indicator 作者: atareao 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, adate=None):
        Gtk.EventBox.__init__(self)
        self.set_size_request(100, 70)
        box1 = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        self.add(box1)
        self.label = Gtk.Label()
        box1.pack_start(self.label, True, True, padding=1)
        self.image = Gtk.Image()
        box1.pack_start(self.image, True, True, padding=1)
        if adate is not None:
            self.set_date(adate)
        self.image.show()
no_account_window.py 文件源码 项目:Gnome-Authenticator 作者: bil-elmoussaoui 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def generate(self):
        logo_image = Gtk.Image()
        logo_image.set_from_icon_name("dialog-information-symbolic",
                                      Gtk.IconSize.DIALOG)
        no_apps_label = Gtk.Label()
        no_apps_label.set_text(_("There's no account at the moment"))

        self.pack_start(logo_image, False, False, 6)
        self.pack_start(no_apps_label, False, False, 6)
add_account.py 文件源码 项目:Gnome-Authenticator 作者: bil-elmoussaoui 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __init__(self, window):
        self.parent = window

        self.selected_logo = None
        self.step = 1
        self.account_image = Gtk.Image(xalign=0)
        self.secret_code = Gtk.Entry()
        self.name_entry = Gtk.Entry()
        self.hb = Gtk.HeaderBar()

        self.generate_window()
        self.generate_components()
        self.generate_header_bar()
add_account.py 文件源码 项目:Gnome-Authenticator 作者: bil-elmoussaoui 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def generate_header_bar(self):
        """
            Generate the header bar box
        """
        self.hb.props.title = _("Add a new account")
        left_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        right_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)

        cancel_button = Gtk.Button.new_with_label(_("Cancel"))
        cancel_button.connect("clicked", self.close_window)
        cancel_button.get_style_context().add_class("destructive-action")
        left_box.add(cancel_button)

        self.apply_button = Gtk.Button.new_with_label(_("Add"))
        self.apply_button.get_style_context().add_class("suggested-action")
        self.apply_button.connect("clicked", self.add_account)
        self.apply_button.set_sensitive(False)

        qr_button = Gtk.Button()
        qr_icon = Gio.ThemedIcon(name="qrscanner-symbolic")
        qr_image = Gtk.Image.new_from_gicon(qr_icon, Gtk.IconSize.BUTTON)
        qr_button.set_tooltip_text(_("Scan a QR code"))
        qr_button.set_image(qr_image)
        qr_button.connect("clicked", self.on_qr_scan)

        right_box.add(qr_button)
        right_box.add(self.apply_button)

        self.hb.pack_start(left_box)
        self.hb.pack_end(right_box)
        self.set_titlebar(self.hb)
MainWindow.py 文件源码 项目:mama 作者: maateen 项目源码 文件源码 阅读 41 收藏 0 点赞 0 评论 0
def __init__(self, app):
        Gtk.Window.__init__(self, title="Mama Manager", application=app)
        self.set_default_size(800, 400)
        self.set_resizable(True)
        self.set_border_width(0)
        self.get_focus()
        self.set_position(Gtk.WindowPosition.CENTER)
        path = os.path.dirname(os.path.abspath(__file__)).strip('librairy')
        self.icon_path = path + 'resources/icons/'
        self.set_default_icon_from_file(path + '/resources/icons.png')

        # get two button to switch between view
        setup_icon = Gtk.Image()
        setup_icon.set_from_file(self.icon_path + 'setup.png')
        button_config = Gtk.ToolButton(icon_widget=setup_icon)
        button_config.set_label("Setup")
        button_config.set_is_important(True)
        button_config.set_tooltip_text('Open setup window')
        button_config.show()
        button_config.connect("clicked", self.change_page, 1)

        button_back = Gtk.Button.new_from_stock(Gtk.STOCK_OK)
        button_back.connect("clicked", self.change_page, 0)
        button_cancel = Gtk.Button.new_from_stock(Gtk.STOCK_CANCEL)
        button_cancel.connect("clicked", self.change_page, 0)

        # get the main view
        content = AddWindow(button_config)
        label_main = Gtk.Label("main")
        config = SetupWindow(button_back, button_cancel)
        label_config = Gtk.Label("config")

        # create a Gtk.Notebook to store both page
        self.notebook = Gtk.Notebook.new()
        self.notebook.set_show_tabs(False)
        self.notebook.append_page(content.get_grid(), label_main)
        self.notebook.append_page(config.getGrid(), label_config)

        # show
        self.add(self.notebook)
        self.show_all()
profile_switcher.py 文件源码 项目:sc-controller 作者: kozec 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def setup_widgets(self):
        # Create
        self._icon = Gtk.Image()
        self._model = Gtk.ListStore(str, object, str)
        self._combo = Gtk.ComboBox.new_with_model(self._model)
        self._box = Gtk.Box(Gtk.Orientation.HORIZONTAL, 0)
        self._savebutton = None
        self._switch_to_button = None

        # Setup
        rend1 = Gtk.CellRendererText()
        rend2 = Gtk.CellRendererText()
        self._icon.set_margin_right(10)
        self._combo.pack_start(rend1, True)
        self._combo.pack_start(rend2, False)
        self._combo.add_attribute(rend1, "text", 0)
        self._combo.add_attribute(rend2, "text", 2)
        self._combo.set_row_separator_func(
            lambda model, iter : model.get_value(iter, 1) is None and model.get_value(iter, 0) == "-" )
        self.update_icon()

        # Signals
        self._combo.connect('changed', self.on_combo_changed)
        self.connect("button_press_event", self.on_button_press)

        # Pack
        self._box.pack_start(self._icon, False, True, 0)
        self._box.pack_start(self._combo, True, True, 0)
        self.add(self._box)
ribar.py 文件源码 项目:sc-controller 作者: kozec 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def build_button(label, icon_name=None, icon_widget=None, use_stock=False):
        """ Builds button situable for action area """
        b = Gtk.Button.new_from_stock(label) if use_stock \
            else Gtk.Button.new_with_label(label)
        b.set_use_underline(True)
        if not icon_name is None:
            icon_widget = Gtk.Image()
            icon_widget.set_from_icon_name(icon_name, Gtk.IconSize.BUTTON)
        if not icon_widget is None:
            b.set_image(icon_widget)
            b.set_always_show_image(True)
        return b
fux-terminal.py 文件源码 项目:fux-terminal 作者: fuxprojesi 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def on_button_press_event(wid, event):
        """
        on_button_press_event: Sa? tu?a t?kland???nda yap?lacak i?lem

        Fare'nin sa? tu?una t?kland???nda bu fonksiyon tetiklenir. Fonksiyon içinde
        T?klanan tu?un sa? tu? olup olmad??? sorgulan?r. E?er do?ru ise aç?l?r menü
        Olu?turulur. Olu?turulam menü argümanlar?na sinyaller atan?r ve gösterilir.
        """
        if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3:
           menu = Gtk.Menu()

           term = Gtk.ImageMenuItem("Terminal Aç")
           term_img = Gtk.Image()
           term_img.set_from_icon_name("utilities-terminal", Gtk.IconSize.MENU)
           term.set_image(term_img)
           term.set_always_show_image(True)

           copy = Gtk.ImageMenuItem("Kopyala")
           copy_img = Gtk.Image()
           copy_img.set_from_icon_name("edit-copy", Gtk.IconSize.MENU)
           copy.set_image(copy_img)
           copy.set_always_show_image(True)

           paste = Gtk.ImageMenuItem("Yap??t?r")
           paste_img = Gtk.Image()
           paste_img.set_from_icon_name("edit-paste", Gtk.IconSize.MENU)
           paste.set_image(paste_img)
           paste.set_always_show_image(True)

           menu.append(term)
           menu.append(Gtk.SeparatorMenuItem())
           menu.append(copy)
           menu.append(paste)

           term.connect("activate", RightClick.open_terminal)
           copy.connect("activate", RightClick.copy_text)
           paste.connect("activate", RightClick.paste_text)

           menu.show_all()
           menu.popup(None, None, None, None, event.button, event.time)
           return True
window.py 文件源码 项目:nvim-pygtk3 作者: rliang 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def update(self, buflist: list, bufcurr: int):
        """Updates the widget's buttons.

        Increases the internal button cache if needed, then displays the
        appropriate amount of buttons, updating their state.

        :buflist: list of tuples (buffer-number, buffer-name, buffer-modified).
        :bufcurr: the active buffer's number.

        """
        self.props.updating = True
        self.bids = [id for id, *_ in buflist]
        for _ in range(len(buflist) - len(self.btns)):
            ico = Gtk.Image(icon_name='document-edit-symbolic')
            btn = Gtk.ToggleButton(None, can_focus=False, image=ico)
            btn.connect('toggled', self._do_button_toggled)
            self.btns.append(btn)
        for btn in self.get_children():
            self.remove(btn)
        for btn, (id, name, modified) in zip(self.btns, buflist):
            btn.set_label(name)
            btn.set_active(id == bufcurr)
            btn.set_always_show_image(modified)
            self.add(btn)
        self.show_all()
        self.props.updating = False
main.py 文件源码 项目:mastodon-gtk 作者: GabMus 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def add_image_to_flowbox(path):
    pbuf=GdkPixbuf.Pixbuf().new_from_file_at_scale(path, -1, 100, True)
    img_w=Gtk.Image()
    img_w.set_from_pixbuf(pbuf)
    toot_image_flowbox.insert(img_w, -1)
    img_w.show()
    img_w.value=path
    images_to_toot.append(path)
    update_show_delete()
rhythm.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def sad_face(self):
        l = gu.HarmonicProgressionLabel(_("Wrong"))
        l.show()
        self.g_box.pack_start(l, False, False, 0)
        self.g_face = Gtk.EventBox()
        self.g_face.connect('button_press_event', self.on_sadface_event)
        self.g_face.show()
        im = Gtk.Image()
        im.set_from_stock('solfege-sadface', Gtk.IconSize.LARGE_TOOLBAR)
        im.show()
        self.g_face.add(im)
        self.g_box.pack_start(self.g_face, False, False, 0)
rhythm.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def happy_face(self):
        l = gu.HarmonicProgressionLabel(_("Correct"))
        l.show()
        self.g_box.pack_start(l, False, False, 0)
        self.g_face = Gtk.EventBox()
        self.g_face.connect('button_press_event', self.on_happyface_event)
        self.g_face.show()
        im = Gtk.Image()
        im.set_from_stock('solfege-happyface', Gtk.IconSize.LARGE_TOOLBAR)
        im.show()
        self.g_face.add(im)
        self.g_box.pack_start(self.g_face, False, False, 0)
rhythm.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def pngbutton(self, i):
        "used by the constructor"
        btn = Gtk.Button()
        if i > len(const.RHYTHMS):
            im = Gtk.Image()
            im.set_from_stock("gtk-missing-image", Gtk.IconSize.LARGE_TOOLBAR)
            im.show()
            btn.add(im)
        else:
            btn.add(gu.create_rhythm_image(const.RHYTHMS[i]))
        btn.show()
        btn.connect('clicked', self.guess_element, i)
        return btn
dictation.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def create_pixmap_button(self):
        im = Gtk.Image()
        im.set_from_stock("solfege-rhythm-c4", Gtk.IconSize.LARGE_TOOLBAR)
        im.show()
        btn = Gtk.Button()
        btn.add(im)
        return btn
solmisation.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def happy_face(self):
        l = gu.HarmonicProgressionLabel(_("Correct"))
        l.show()
        self.g_box.pack_start(l, False, False, 0)
        self.g_face = Gtk.EventBox()
        self.g_face.connect('button_press_event', self.on_happyface_event)
        self.g_face.show()
        im = Gtk.Image()
        im.set_from_stock('solfege-happyface', Gtk.IconSize.LARGE_TOOLBAR)
        im.show()
        self.g_face.add(im)
        self.g_box.pack_start(self.g_face, False, False, 0)


问题


面经


文章

微信
公众号

扫码关注公众号