本文整理汇总了Python中gtk.VBox方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.VBox方法的具体用法?Python gtk.VBox怎么用?Python gtk.VBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.VBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def run(self, graphic):
window = gtk.Window()
self.__window = window
window.set_default_size(200, 200)
vbox = gtk.VBox()
window.add(vbox)
render = GtkGraphicRenderer(graphic)
self.__render = render
vbox.pack_end(render, True, True, 0)
hbox = gtk.HBox()
vbox.pack_start(hbox, False, False, 0)
smaller_zoom = gtk.Button("Zoom Out")
smaller_zoom.connect("clicked", self.__set_smaller_cb)
hbox.pack_start(smaller_zoom)
bigger_zoom = gtk.Button("Zoom In")
bigger_zoom.connect("clicked", self.__set_bigger_cb)
hbox.pack_start(bigger_zoom)
output_png = gtk.Button("Output Png")
output_png.connect("clicked", self.__output_png_cb)
hbox.pack_start(output_png)
window.connect('destroy', gtk.main_quit)
window.show_all()
#gtk.bindings_activate(gtk.main_quit, 'q', 0)
gtk.main()
示例2: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def __init__(self, item_spacing=ITEM_SPACING, *args, **kwargs):
super().__init__(*args, **kwargs)
self._item_spacing = item_spacing
self._drag_and_drop_context = draganddropcontext_.DragAndDropContext()
self._items = []
self._vbox_items = gtk.VBox(homogeneous=False)
self._vbox_items.set_spacing(self._item_spacing)
self._vbox = gtk.VBox(homogeneous=False)
self._vbox.set_spacing(self.VBOX_SPACING)
self._vbox.pack_start(self._vbox_items, expand=False, fill=False)
self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.add_with_viewport(self._vbox)
self.get_child().set_shadow_type(gtk.SHADOW_NONE)
示例3: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def __init__(self, cli, memobj, syms=None):
vw_layout.LayoutWindow.__init__(self)
self.cli = cli
self.connect("key-press-event", self.keypressed)
self.vbox = gtk.VBox()
self.menubar = vw_menu.MenuBar()
self.add(self.vbox)
self.vbox.pack_start(self.menubar, expand=False)
toolbar = self.getMainToolbar()
if toolbar != None:
self.vbox.pack_start(toolbar, expand=False)
self.canvas = vw_memview.ScrolledMemoryView(memobj, syms=syms)
self.canvas.textview.set_property("wrap_mode", gtk.WRAP_WORD)
self.vbox.pack_start(self.canvas, expand=True)
# If it's an EnviCli, let's over-ride the canvas right away.
if isinstance(cli, e_cli.EnviCli):
cli.setCanvas(self.canvas)
entry = gtk.Entry()
entry.connect("activate", self.cli_activate)
entry.connect("key-press-event", self.entrykeypressed)
self.vbox.pack_start(entry, expand=False)
self.entry = entry
self.history = []
self.histidx = 0
entry.grab_focus()
示例4: build_gui
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def build_gui(self):
"""
Build the GUI interface.
"""
vbox = gtk.VBox()
self.top = vbox
button_panel = gtk.Toolbar()
self.button_add = button_panel.insert_stock(gtk.STOCK_ADD, _("Add Mapping"), None, self.add_mapping_clicked, None, -1)
self.button_edit = button_panel.insert_stock(gtk.STOCK_EDIT, _("Edit Mapping"), None, self.edit_mapping_clicked, None, -1)
self.button_del = button_panel.insert_stock(gtk.STOCK_REMOVE, _("Remove Mapping"), None, self.remove_mapping_clicked, None, -1)
vbox.pack_start(button_panel, expand=False, fill=True, padding=5)
self.treestore = gtk.TreeStore(str, str)
self.treeview = gtk.TreeView(self.treestore)
self.treeview.connect("row-activated", self.row_double_clicked)
self.column1 = gtk.TreeViewColumn(_('Surname'))
self.column2 = gtk.TreeViewColumn(_('Group Name'))
self.treeview.append_column(self.column1)
self.treeview.append_column(self.column2)
self.cell1 = gtk.CellRendererText()
self.cell2 = gtk.CellRendererText()
self.column1.pack_start(self.cell1, True)
self.column1.add_attribute(self.cell1, 'text', 0)
self.column2.pack_start(self.cell2, True)
self.column2.add_attribute(self.cell2, 'text', 1)
self.treeview.set_search_column(0)
self.column1.set_sort_column_id(0)
self.column2.set_sort_column_id(1)
vbox.pack_start(self.treeview, expand=True, fill=True)
return vbox
示例5: run
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def run(self, graphic):
"""! Run function
@param self this object
@param graphic graphic
@return none
"""
window = gtk.Window()
self.__window = window
window.set_default_size(200, 200)
vbox = gtk.VBox()
window.add(vbox)
render = GtkGraphicRenderer(graphic)
self.__render = render
vbox.pack_end(render, True, True, 0)
hbox = gtk.HBox()
vbox.pack_start(hbox, False, False, 0)
smaller_zoom = gtk.Button("Zoom Out")
smaller_zoom.connect("clicked", self.__set_smaller_cb)
hbox.pack_start(smaller_zoom)
bigger_zoom = gtk.Button("Zoom In")
bigger_zoom.connect("clicked", self.__set_bigger_cb)
hbox.pack_start(bigger_zoom)
output_png = gtk.Button("Output Png")
output_png.connect("clicked", self.__output_png_cb)
hbox.pack_start(output_png)
window.connect('destroy', gtk.main_quit)
window.show_all()
#gtk.bindings_activate(gtk.main_quit, 'q', 0)
gtk.main()
示例6: _get_report_link_buttons
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def _get_report_link_buttons(
report_uri_list, report_description, label_report_text_instructions):
if not report_uri_list:
return None
vbox_link_buttons = gtk.VBox(homogeneous=False)
if report_description:
label_report_text = report_description
if not _webbrowser_module_found:
label_report_text += " " + label_report_text_instructions
label_report_text += ":"
label_report = gtk.Label(label_report_text)
label_report.set_alignment(0, 0.5)
label_report.set_padding(3, 3)
label_report.set_line_wrap(True)
label_report.set_line_wrap_mode(pango.WRAP_WORD)
vbox_link_buttons.pack_start(label_report, expand=False, fill=False)
report_linkbuttons = []
for name, uri in report_uri_list:
linkbutton = gtk.LinkButton(uri, label=name)
linkbutton.set_alignment(0, 0.5)
report_linkbuttons.append(linkbutton)
for linkbutton in report_linkbuttons:
vbox_link_buttons.pack_start(linkbutton, expand=False, fill=False)
if _webbrowser_module_found:
# Apparently, GTK doesn't know how to open URLs on Windows, hence the custom
# solution.
for linkbutton in report_linkbuttons:
linkbutton.connect(
"clicked", lambda linkbutton: webbrowser.open_new_tab(linkbutton.get_uri()))
return vbox_link_buttons
示例7: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [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()
示例8: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [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: get_splash
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [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
示例10: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def __init__(self, title, message, default_text='', modal=True, mask=False):
gtk.Dialog.__init__(self)
self.set_title(title)
self.connect("destroy", self.quit)
self.connect("delete_event", self.quit)
if modal:
self.set_modal(True)
box = gtk.VBox(spacing=10)
box.set_border_width(10)
self.vbox.pack_start(box)
box.show()
if message:
label = gtk.Label(message)
box.pack_start(label)
label.show()
self.entry = gtk.Entry()
self.entry.set_text(default_text)
self.entry.set_visibility(not mask)
box.pack_start(self.entry)
self.entry.show()
self.entry.grab_focus()
button = gtk.Button(stock=gtk.STOCK_OK)
button.connect("clicked", self.click)
self.entry.connect("activate", self.click)
button.set_flags(gtk.CAN_DEFAULT)
self.action_area.pack_start(button)
button.show()
button.grab_default()
button = gtk.Button(stock=gtk.STOCK_CANCEL)
button.connect("clicked", self.quit)
button.set_flags(gtk.CAN_DEFAULT)
self.action_area.pack_start(button)
button.show()
self.ret = None
示例11: construct_confirm_close
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def construct_confirm_close(self, window, reqtype):
"""Create a confirmation dialog for closing things"""
# skip this dialog if applicable
if self.config['suppress_multiple_term_dialog']:
return gtk.RESPONSE_ACCEPT
dialog = gtk.Dialog(_('Close?'), window, gtk.DIALOG_MODAL)
dialog.set_has_separator(False)
dialog.set_resizable(False)
dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
c_all = dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT)
c_all.get_children()[0].get_children()[0].get_children()[1].set_label(
_('Close _Terminals'))
primary = gtk.Label(_('<big><b>Close multiple terminals?</b></big>'))
primary.set_use_markup(True)
primary.set_alignment(0, 0.5)
secondary = gtk.Label(_('This %s has several terminals open. Closing \
the %s will also close all terminals within it.') % (reqtype, reqtype))
secondary.set_line_wrap(True)
labels = gtk.VBox()
labels.pack_start(primary, False, False, 6)
labels.pack_start(secondary, False, False, 6)
image = gtk.image_new_from_stock(gtk.STOCK_DIALOG_WARNING,
gtk.ICON_SIZE_DIALOG)
image.set_alignment(0.5, 0)
box = gtk.HBox()
box.pack_start(image, False, False, 6)
box.pack_start(labels, False, False, 6)
dialog.vbox.pack_start(box, False, False, 12)
checkbox = gtk.CheckButton(_("Do not show this message next time"))
dialog.vbox.pack_end(checkbox)
dialog.show_all()
result = dialog.run()
# set configuration
self.config['suppress_multiple_term_dialog'] = checkbox.get_active()
self.config.save()
dialog.destroy()
return(result)
示例12: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def __init__(self, canvas):
self.canvas = canvas
vw_layout.LayoutWindow.__init__(self)
self.vbox = gtk.VBox()
elabel = gtk.Label(" Memory Expression ")
slabel = gtk.Label(" Memory Size ")
self.eentry = gtk.Entry()
self.sentry = gtk.Entry()
self.sentry.set_text("256")
self.nextbutton = gtk.Button()
i = gtk.image_new_from_stock(gtk.STOCK_GO_FORWARD, gtk.ICON_SIZE_BUTTON)
self.nextbutton.set_image(i)
self.nextbutton.connect("clicked", self.goforward)
self.backbutton = gtk.Button()
i = gtk.image_new_from_stock(gtk.STOCK_GO_BACK, gtk.ICON_SIZE_BUTTON)
self.backbutton.set_image(i)
self.backbutton.connect("clicked", self.goback)
self.downbutton = gtk.Button()
i = gtk.image_new_from_stock(gtk.STOCK_GO_DOWN, gtk.ICON_SIZE_BUTTON)
self.downbutton.set_image(i)
self.downbutton.connect("clicked", self.godown)
self.upbutton = gtk.Button()
i = gtk.image_new_from_stock(gtk.STOCK_GO_UP, gtk.ICON_SIZE_BUTTON)
self.upbutton.set_image(i)
self.upbutton.connect("clicked", self.goup)
hbox = gtk.HBox()
hbox.pack_start(self.backbutton, expand=False)
hbox.pack_start(self.nextbutton, expand=False)
hbox.pack_start(self.upbutton, expand=False)
hbox.pack_start(self.downbutton, expand=False)
hbox.pack_start(elabel, expand=False)
hbox.pack_start(self.eentry, expand=True)
hbox.pack_start(slabel, expand=False)
hbox.pack_start(self.sentry, expand=True)
self.cbox = gtk.combo_box_new_text()
for name in self.canvas.getRendererNames():
self.canvas.addRenderer(name, self.canvas.getRenderer(name))
self.cbox.append_text(name)
self.cbox.set_active(0)
hbox.pack_start(self.cbox, expand=False)
self.vbox.pack_start(hbox, expand=False)
self.vbox.pack_start(self.canvas, expand=True)
self.add(self.vbox)
self.eentry.connect("activate", self.entryActivated)
self.sentry.connect("activate", self.entryActivated)
self.cbox.connect("changed", self.updateMemoryView)
self.canvas.memwin = self
self.updateHistoryButtons()
示例13: unicast_packets
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def unicast_packets(argv, community="public"):
"""Display a set of strip charts, one for each set of parameters in argv.
The set is a "host interface" pair. For example: device1 2 device2 4 """
win = gtk.Window(gtk.WINDOW_TOPLEVEL)
win.set_title("Unicast Packets")
vbox = gtk.VBox()
vbox.show()
win.add(vbox)
sessions = {}
while argv:
host = argv.pop(0)
ifindex = int(argv.pop(0))
if host in sessions:
sess = sessions[host]
else:
sess = SNMP.get_session(host, community)
sessions[host] = sess
graph = rtgraph.HScrollLineGraph(
scrollRate = 2,
pollInterval = 1000,
size = (384,128),
gridSize = 32,
channels = [SNMPChannel(sess, IF_MIB.ifInUcastPkts, ifindex, color=(1,0,0)),
SNMPChannel(sess, IF_MIB.ifOutUcastPkts, ifindex, color=(0,1,0))],
bgColor = (0, 0, 0.3),
gridColor = (0, 0, 0.5),
range = (0, 19),
)
graph.show()
frame = gtk.Frame()
frame.set_label("device %s ifindex %s" % (host, ifindex))
frame.add(graph)
frame.show()
vbox.pack_end(frame)
del sessions
win.show()
win.connect("destroy", gtk.main_quit)
gtk.main()
示例14: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def __init__(self, width, height):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
self.window.set_border_width(0)
self.window.set_size_request(width, height + 30)
self.window.set_app_paintable(True)
self.screen = self.window.get_screen()
self.rgba = self.screen.get_rgba_colormap()
self.window.set_colormap(self.rgba)
self.window.connect('expose-event', self.expose)
self.vbox = gtk.VBox(False, 5)
self.hbox = gtk.HBox(False, 3)
self.bbox = gtk.HBox(True, 3)
self.entry = gtk.Entry()
self.entry.set_max_length(0)
self.entry.set_size_request(int(width/2), 25)
self.entry.connect("activate", self.enter_callback, self.entry)
self.spr = gtk.ToggleButton(label='spr')
self.spr.connect("toggled", self.on_button_toggled, 'spr')
self.ctrl = gtk.ToggleButton(label='ctrl')
self.ctrl.connect("toggled", self.on_button_toggled, 'ctrl')
self.alt = gtk.ToggleButton(label='alt')
self.alt.connect("toggled", self.on_button_toggled, 'alt')
self.enter = gtk.Button(label='Enter')
self.enter.connect("clicked", self.on_enter_clicked)
self.backspace = gtk.Button(label='Backspace')
self.backspace.connect("clicked", self.on_backspace_clicked)
self.shell = gtk.Button(label='R-Shell')
self.shell.connect("clicked", self.on_shell_clicked, self.entry)
self.hbox.add(self.entry)
self.bbox.add(self.spr)
self.bbox.add(self.ctrl)
self.bbox.add(self.alt)
self.bbox.add(self.enter)
self.bbox.add(self.backspace)
self.bbox.add(self.shell)
self.hbox.add(self.bbox)
self.halign = gtk.Alignment(1, 0, 1, 0)
self.halign.add(self.hbox)
self.allalign = gtk.Alignment(0, 0, 1, 1)
self.clickbox = gtk.EventBox()
self.clickbox.connect('button-press-event', self.on_click)
self.clickbox.set_visible_window(False)
self.allalign.add(self.clickbox)
self.vbox.pack_start(self.allalign, True, True, 0)
self.vbox.pack_end(self.halign, False, False, 0)
self.window.add(self.vbox)
self.window.show_all()
self.window.move(100, 100)
示例15: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import VBox [as 别名]
def __init__(self):
gtk.Window.__init__(self)
self.graph = Graph()
window = self
window.set_title('Dot Viewer')
window.set_default_size(512, 512)
vbox = gtk.VBox()
window.add(vbox)
self.widget = DotWidget()
# Create a UIManager instance
uimanager = self.uimanager = gtk.UIManager()
# Add the accelerator group to the toplevel window
accelgroup = uimanager.get_accel_group()
window.add_accel_group(accelgroup)
# Create an ActionGroup
actiongroup = gtk.ActionGroup('Actions')
self.actiongroup = actiongroup
# Create actions
actiongroup.add_actions((
('Open', gtk.STOCK_OPEN, None, None, None, self.on_open),
('Reload', gtk.STOCK_REFRESH, None, None, None, self.on_reload),
('ZoomIn', gtk.STOCK_ZOOM_IN, None, None, None, self.widget.on_zoom_in),
('ZoomOut', gtk.STOCK_ZOOM_OUT, None, None, None, self.widget.on_zoom_out),
('ZoomFit', gtk.STOCK_ZOOM_FIT, None, None, None, self.widget.on_zoom_fit),
('Zoom100', gtk.STOCK_ZOOM_100, None, None, None, self.widget.on_zoom_100),
))
# Add the actiongroup to the uimanager
uimanager.insert_action_group(actiongroup, 0)
# Add a UI descrption
uimanager.add_ui_from_string(self.ui)
# Create a Toolbar
toolbar = uimanager.get_widget('/ToolBar')
vbox.pack_start(toolbar, False)
vbox.pack_start(self.widget)
self.set_focus(self.widget)
self.show_all()