本文整理汇总了Python中gtk.Image方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.Image方法的具体用法?Python gtk.Image怎么用?Python gtk.Image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.Image方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createTabLabel
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def createTabLabel(page, notebook):
label = gtk.Label(page.vwGetDisplayName())
if not page.vwIsClosable():
return label
box = gtk.HBox()
image = gtk.Image()
image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_SMALL_TOOLBAR)
cbutton = gtk.Button()
cbutton.connect("clicked", closeTabButton, page, notebook)
cbutton.set_image(image)
cbutton.set_relief(gtk.RELIEF_NONE)
box.pack_start(label, True, True)
box.pack_end(cbutton, False, False)
box.show_all()
return box
示例2: update_button
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def update_button(self):
"""Update the state of our close button"""
if not self.config['close_button_on_tab']:
if self.button:
self.button.remove(self.icon)
self.remove(self.button)
del(self.button)
del(self.icon)
self.button = None
self.icon = None
return
if not self.button:
self.button = gtk.Button()
if not self.icon:
self.icon = gtk.Image()
self.icon.set_from_stock(gtk.STOCK_CLOSE,
gtk.ICON_SIZE_MENU)
self.button.set_focus_on_click(False)
self.button.set_relief(gtk.RELIEF_NONE)
style = gtk.RcStyle()
style.xthickness = 0
style.ythickness = 0
self.button.modify_style(style)
self.button.add(self.icon)
self.button.connect('clicked', self.on_close)
self.button.set_name('terminator-tab-close-button')
if hasattr(self.button, 'set_tooltip_text'):
self.button.set_tooltip_text(_('Close Tab'))
self.pack_start(self.button, False, False)
self.show_all()
示例3: callback
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def callback(self, menuitems, menu, terminal):
"""Add our menu items to the menu"""
item = gtk.MenuItem(_('Custom Commands'))
menuitems.append(item)
submenu = gtk.Menu()
item.set_submenu(submenu)
menuitem = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
menuitem.connect("activate", self.configure)
submenu.append(menuitem)
menuitem = gtk.SeparatorMenuItem()
submenu.append(menuitem)
theme = gtk.IconTheme()
for command in self.cmd_list:
if not command['enabled']:
continue
exe = command['command'].split(' ')[0]
iconinfo = theme.choose_icon([exe], gtk.ICON_SIZE_MENU, gtk.ICON_LOOKUP_USE_BUILTIN)
if iconinfo:
image = gtk.Image()
image.set_from_icon_name(exe, gtk.ICON_SIZE_MENU)
menuitem = gtk.ImageMenuItem(command['name'])
menuitem.set_image(image)
else:
menuitem = gtk.MenuItem(command["name"])
menuitem.connect("activate", self._execute, {'terminal' : terminal, 'command' : command['command'] })
submenu.append(menuitem)
示例4: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def __init__(self):
self.dialog_title = ""
self.daemon_STOCK = gtk.STOCK_YES
self.sun_icon = "{0}{1}.png".format(icon_path, __all__)
self.icon = gtk.status_icon_new_from_file(self.sun_icon)
self.icon.connect("popup-menu", self.right_click)
self.img = gtk.Image()
self.img.set_from_file(self.sun_icon)
self.icon.set_tooltip("Slackware Update Notifier")
self.cmd = "{0}sun_daemon".format(bin_path)
self.daemon_start()
gtk.main()
示例5: finish
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def finish(self):
image = gtk.Image()
image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
self.widget2.set_image(image)
self.widget2.set_label("Close")
示例6: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def __init__(self):
super(app, self).__init__()
self.set_position(gtk.WIN_POS_CENTER)
self.set_title("Edge Threshold Adjuster")
self.set_decorated(True)
self.set_has_frame(False)
self.set_resizable(False)
self.set_default_size(self.window_width,self.window_height)
self.connect("destroy", gtk.main_quit)
vbox = gtk.VBox(spacing=4)
#Setup the slider bar
scale = gtk.HScale()
scale.set_range(self.min_threshold, self.max_threshold)
scale.set_size_request(500, 25)
scale.set_value((self.max_threshold + self.min_threshold) / 2)
scale.connect("value-changed", self.update_threshold)
vbox.add(scale)
#Setup the information label
info = gtk.Label()
info.set_label("Move the slider to adjust the edge detection threshold")
vbox.add(info)
#Add the image to the display
new_image = self.process_image()
converted_image = gtk.gdk.pixbuf_new_from_array(new_image, gtk.gdk.COLORSPACE_RGB, 8)
image = gtk.Image()
image.set_from_pixbuf(converted_image)
image.show()
vbox.add(image)
self.current_image = image
self.add(vbox)
self.show_all()
示例7: process_image
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def process_image(self):
#Start SimpleCV Code
img = SimpleCV.Image('lenna').rotate90()
edges = img.edges(self.edge_threshold)
numpy_img = edges.getNumpy()
#End SimpleCV Code
return numpy_img
#This function is called anything the slider is moved
示例8: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def __init__(self):
super(app, self).__init__()
self.set_position(gtk.WIN_POS_CENTER)
self.set_title("Edge Threshold Adjuster")
self.set_decorated(True)
self.set_has_frame(False)
self.set_resizable(False)
self.set_default_size(self.window_width,self.window_height)
self.connect("destroy", gtk.main_quit)
vbox = gtk.VBox(spacing=4)
#Setup the slider bar
scale = gtk.HScale()
scale.set_range(self.min_threshold, self.max_threshold)
scale.set_size_request(500, 25)
scale.set_value((self.max_threshold + self.min_threshold) / 2)
scale.connect("value-changed", self.update_threshold)
vbox.add(scale)
#Setup the information label
info = gtk.Label()
info.set_label("Move the slider to adjust the edge detection threshold")
vbox.add(info)
#Add the image to the display
new_image = self.process_image()
converted_image = gtk.gdk.pixbuf_new_from_array(new_image, gtk.gdk.COLORSPACE_RGB, 8)
image = gtk.Image()
image.set_from_pixbuf(converted_image)
image.show()
vbox.add(image)
gobject.timeout_add(self.refresh_rate, self.refresh)
self.current_image = image
self.add(vbox)
self.show_all()
示例9: _main_window_indicator
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def _main_window_indicator(self, menu_container, icon_container):
if not self._HAVE_INDICATOR:
menubar = gtk.MenuBar()
im = gtk.MenuItem(self.config.get('app_name', 'GUI-o-Matic'))
im.set_submenu(self.menu)
menubar.append(im)
menu_container.pack_start(menubar, False, True)
icon = gtk.Image()
icon_container.pack_start(icon, False, True)
self.main_window['indicator_icon'] = icon
示例10: get_splash
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def get_splash():
splash = gtk.Window(gtk.WINDOW_TOPLEVEL)
splash.set_events(splash.get_events() | gtk.gdk.BUTTON_PRESS_MASK)
def f(widget, data=None):
splash.destroy()
splash.connect('button_press_event', f)
eb = gtk.EventBox()
eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
image = gtk.Image()
image.show()
image.set_from_file(os.path.join(rpy2.__path__[0], "images", "rpy2_logo.png"))
splashVBox = gtk.VBox()
splashVBox.pack_start(image, True, True, 0)
splashVBox.pack_start(gtk.Label("A GTK+ toy user interface"),
True, True, 0)
eb.add(splashVBox)
splash.add(eb)
splash.realize()
splash.window.set_type_hint (gtk.gdk.WINDOW_TYPE_HINT_SPLASHSCREEN)
# needed on Win32
splash.set_decorated (False)
splash.set_position (gtk.WIN_POS_CENTER)
return splash
示例11: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def __init__(self, terminal):
"""Class initialiser"""
gtk.EventBox.__init__(self)
self.__gobject_init__()
self.terminator = Terminator()
self.terminal = terminal
self.config = self.terminal.config
self.label = EditableLabel()
self.label.connect('edit-done', self.on_edit_done)
self.ebox = gtk.EventBox()
grouphbox = gtk.HBox()
self.grouplabel = gtk.Label()
self.groupicon = gtk.Image()
self.bellicon = gtk.Image()
self.bellicon.set_no_show_all(True)
self.groupentry = gtk.Entry()
self.groupentry.set_no_show_all(True)
self.groupentry.connect('focus-out-event', self.groupentry_cancel)
self.groupentry.connect('activate', self.groupentry_activate)
self.groupentry.connect('key-press-event', self.groupentry_keypress)
groupsend_type = self.terminator.groupsend_type
if self.terminator.groupsend == groupsend_type['all']:
icon_name = 'all'
elif self.terminator.groupsend == groupsend_type['group']:
icon_name = 'group'
elif self.terminator.groupsend == groupsend_type['off']:
icon_name = 'off'
self.set_from_icon_name('_active_broadcast_%s' % icon_name,
gtk.ICON_SIZE_MENU)
grouphbox.pack_start(self.groupicon, False, True, 2)
grouphbox.pack_start(self.grouplabel, False, True, 2)
grouphbox.pack_start(self.groupentry, False, True, 2)
self.ebox.add(grouphbox)
self.ebox.show_all()
self.bellicon.set_from_icon_name('terminal-bell', gtk.ICON_SIZE_MENU)
hbox = gtk.HBox()
hbox.pack_start(self.ebox, False, True, 0)
hbox.pack_start(gtk.VSeparator(), False, True, 0)
hbox.pack_start(self.label, True, True)
hbox.pack_end(self.bellicon, False, False, 2)
self.add(hbox)
hbox.show_all()
self.set_no_show_all(True)
self.show()
self.connect('button-press-event', self.on_clicked)
示例12: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def __init__(self):
"""Class initialiser"""
gtk.HBox.__init__(self)
self.__gobject_init__()
self.config = Config()
# Search text
self.entry = gtk.Entry()
self.entry.set_activates_default(True)
self.entry.show()
self.entry.connect('activate', self.do_search)
self.entry.connect('key-press-event', self.search_keypress)
# Label
label = gtk.Label(_('Search:'))
label.show()
# Result label
self.reslabel = gtk.Label('')
self.reslabel.show()
# Close Button
close = gtk.Button()
close.set_relief(gtk.RELIEF_NONE)
close.set_focus_on_click(False)
icon = gtk.Image()
icon.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
close.add(icon)
close.set_name('terminator-search-close-button')
if hasattr(close, 'set_tooltip_text'):
close.set_tooltip_text(_('Close Search bar'))
close.connect('clicked', self.end_search)
close.show_all()
# Next Button
self.next = gtk.Button(_('Next'))
self.next.show()
self.next.set_sensitive(False)
self.next.connect('clicked', self.next_search)
# Previous Button
self.prev = gtk.Button(_('Prev'))
self.prev.show()
self.prev.set_sensitive(False)
self.prev.connect('clicked', self.prev_search)
self.pack_start(label, False)
self.pack_start(self.entry)
self.pack_start(self.reslabel, False)
self.pack_start(self.prev, False, False)
self.pack_start(self.next, False, False)
self.pack_end(close, False, False)
self.hide()
self.set_no_show_all(True)
示例13: _init_gui
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def _init_gui(self):
self._button_menu = gtk.Button()
self._button_menu.set_relief(gtk.RELIEF_NONE)
self._button_menu.add(gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_IN))
self._menu_item_update_automatically = gtk.CheckMenuItem(
_("Update Preview Automatically"))
self._menu_item_update_automatically.set_active(True)
self._menu_settings = gtk.Menu()
self._menu_settings.append(self._menu_item_update_automatically)
self._menu_settings.show_all()
self._button_refresh = gtk.Button()
self._button_refresh.set_tooltip_text(_("Update Preview"))
self._button_refresh.set_relief(gtk.RELIEF_NONE)
self._button_refresh.add(gtk.image_new_from_pixbuf(
self._button_refresh.render_icon(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU)))
self._button_refresh.show_all()
self._button_refresh.hide()
self._button_refresh.set_no_show_all(True)
self._hbox_buttons = gtk.HBox()
self._hbox_buttons.pack_start(self._button_menu, expand=False, fill=False)
self._hbox_buttons.pack_start(self._button_refresh, expand=False, fill=False)
self._preview_image = gtk.Image()
self._preview_image.set_no_show_all(True)
self._placeholder_image = gtk.Image()
self._placeholder_image.set_from_stock(
gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
self._placeholder_image.set_no_show_all(True)
self._label_layer_name = gtk.Label()
self._label_layer_name.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
self.set_spacing(self._WIDGET_SPACING)
self.set_border_width(self._BORDER_WIDTH)
self.pack_start(self._hbox_buttons, expand=False, fill=False)
self.pack_start(self._preview_image, expand=True, fill=True)
self.pack_start(self._placeholder_image, expand=True, fill=True)
self.pack_start(self._label_layer_name, expand=False, fill=False)
self._show_placeholder_image()
示例14: _init_gui
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Image [as 别名]
def _init_gui(self):
self._dialog = gimpui.Dialog(
title="",
role=None,
parent=self._parent,
flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
self._dialog.set_transient_for(self._parent)
self._dialog.set_title(self._title)
self._dialog.set_border_width(self._DIALOG_BORDER_WIDTH)
self._dialog.set_resizable(False)
self._dialog_icon = gtk.Image()
self._dialog_icon.set_from_stock(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
self._dialog_text = gtk.Label("")
self._dialog_text.set_line_wrap(True)
self._dialog_text.set_use_markup(True)
self._dialog_text_event_box = gtk.EventBox()
self._dialog_text_event_box.add(self._dialog_text)
self._hbox_dialog_contents = gtk.HBox(homogeneous=False)
self._hbox_dialog_contents.set_spacing(self._DIALOG_HBOX_CONTENTS_SPACING)
self._hbox_dialog_contents.pack_start(self._dialog_icon, expand=False, fill=False)
self._hbox_dialog_contents.pack_start(
self._dialog_text_event_box, expand=False, fill=False)
self._checkbutton_apply_to_all = gtk.CheckButton(
label=_("_Apply action to all files"))
self._checkbutton_apply_to_all.set_use_underline(True)
self._dialog.vbox.set_spacing(self._DIALOG_VBOX_SPACING)
self._dialog.vbox.pack_start(self._hbox_dialog_contents, expand=False, fill=False)
self._dialog.vbox.pack_start(self._checkbutton_apply_to_all, expand=False, fill=False)
self._buttons = {}
for value, display_name in self.values_and_display_names:
self._buttons[value] = self._dialog.add_button(display_name, value)
self._dialog.action_area.set_spacing(self._DIALOG_ACTION_AREA_SPACING)
self._checkbutton_apply_to_all.connect(
"toggled", self._on_checkbutton_apply_to_all_toggled)
self._is_dialog_text_allocated_size = False
self._dialog_text_event_box.connect(
"size-allocate", self._on_dialog_text_event_box_size_allocate)
self._dialog.set_focus(self._buttons[self.default_value])