本文整理汇总了Python中gi.repository.Gtk.VBox方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.VBox方法的具体用法?Python Gtk.VBox怎么用?Python Gtk.VBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.VBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_ui
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def init_ui(self):
vbox0 = Gtk.VBox(spacing=5)
vbox0.set_border_width(5)
self.get_content_area().add(vbox0)
frame1 = Gtk.Frame()
vbox0.add(frame1)
self.grid = Gtk.Grid()
self.grid.set_row_spacing(10)
self.grid.set_column_spacing(10)
self.grid.set_margin_bottom(10)
self.grid.set_margin_start(10)
self.grid.set_margin_end(10)
self.grid.set_margin_top(10)
frame1.add(self.grid)
示例2: init
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def init(self):
self.selected_handles = set()
self.relationship_calc = get_relationship_calculator()
self.set_tooltip(_("Double-click name for details"))
self.set_text(_("No Family Tree loaded."))
self.set_use_markup(True)
self.gui.get_container_widget().remove(self.gui.textview)
vbox = Gtk.VBox()
hbox = Gtk.HBox()
pause_button = Gtk.Button(_("Pause"))
pause_button.connect("clicked", self.interrupt)
continue_button = Gtk.Button(_("Continue"))
continue_button.connect("clicked", self.resume)
copy_button = Gtk.Button(_("Copy"))
copy_button.connect("clicked", lambda widget: \
self.gui.pane.pageview.copy_to_clipboard('Person', self.selected_handles))
hbox.pack_start(pause_button, '', '', True)
hbox.pack_start(copy_button, '', '', True)
hbox.pack_start(continue_button, '', '', True)
vbox.pack_start(self.gui.textview, '', '', True)
vbox.pack_start(hbox, '', '', False)
self.gui.get_container_widget().add_with_viewport(vbox)
vbox.show_all()
示例3: build_thumbnail_gui
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def build_thumbnail_gui(self, pbloader, width, height):
"""
builds the thumbnail viewing area.
"""
main_vbox = Gtk.VBox()
main_vbox.set_size_request((width - 30), (height - 30))
hbox = Gtk.HBox(homogeneous=False, spacing=0)
main_vbox.pack_start(hbox, expand=False, fill=False, padding=5)
hbox.show()
# Get the resulting pixbuf and build an image to be displayed
pixbuf = pbloader.get_pixbuf()
pbloader.close()
imgwidget = Gtk.Image()
imgwidget.set_from_pixbuf(pixbuf)
hbox.pack_start(imgwidget, expand=False, fill=True, padding=0)
imgwidget.show()
main_vbox.show_all()
return main_vbox
示例4: insert_table
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def insert_table(self, widget):
self.insert_window_table = Gtk.Window()
self.insert_window_table.set_title("Insert Table")
self.insert_window_table.set_resizable(True)
self.insert_window_table.set_border_width(6)
self.insert_window_table.set_default_size(300, 250)
self.insert_window_table.set_position(Gtk.WindowPosition.CENTER)
vbox = Gtk.VBox()
label_n_rows = Gtk.Label("Number of Rows:")
self.entry_n_rows = Gtk.Entry()
label_n_columns = Gtk.Label("Number of Columns")
self.entry_n_columns = Gtk.Entry()
vbox.pack_start(label_n_rows, self, False, False)
vbox.pack_start(self.entry_n_rows, self, False, False)
vbox.pack_start(label_n_columns, self, False, False)
vbox.pack_start(self.entry_n_columns, self, False, False)
button = Gtk.Button("Insert Table")
vbox.pack_end(button, self, False, False)
self.insert_window_table.add(vbox)
self.insert_window_table.show_all()
button.connect("clicked", self.insert_table_cmd, self.insert_window_table)
示例5: on_menuitem_custom_activate
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def on_menuitem_custom_activate(self, widget):
self.custom_window = Gtk.Window()
self.custom_window.set_default_size(640, 480)
self.custom_window.set_position(Gtk.WindowPosition.CENTER)
self.custom_window.set_title("Custom CSS")
self.custom_vbox = Gtk.VBox()
self.custom_scroller = Gtk.ScrolledWindow()
self.custom_button = Gtk.Button("Apply")
self.custom_vbox.pack_end(self.custom_button, False, False, 0)
self.custom_text_view = Gtk.TextView()
self.custom_text_buffer = Gtk.TextBuffer()
self.custom_text_buffer.set_text(self.custom_css)
self.custom_text_view.set_buffer(self.custom_text_buffer)
self.custom_scroller.add(self.custom_text_view)
self.custom_vbox.pack_start(self.custom_scroller, True, True, 0)
self.custom_window.add(self.custom_vbox)
self.custom_window.show_all()
self.custom_button.connect("clicked", self.apply_custom_css, self.custom_window, self.custom_text_buffer)
示例6: initBoardAndClock
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def initBoardAndClock(self, gamemodel):
boardvbox = Gtk.VBox()
boardvbox.set_spacing(2)
infobar = InfoBarNotebook("gamewidget_infobar")
ccalign = createAlignment(0, 0, 0, 0)
cclock = ChessClock()
cclock.setModel(gamemodel.timemodel)
ccalign.add(cclock)
ccalign.set_size_request(-1, 32)
boardvbox.pack_start(ccalign, False, True, 0)
actionMenuDic = {}
for item in ACTION_MENU_ITEMS:
actionMenuDic[item] = widgets[item]
if self.gamemodel.offline_lecture:
preview = True
else:
preview = False
board = BoardControl(gamemodel, actionMenuDic, game_preview=preview)
boardvbox.pack_start(board, True, True, 0)
return boardvbox, board, infobar, cclock
示例7: get_infobarmessage_content2
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def get_infobarmessage_content2(player,
heading_text,
message_text,
gametype=None):
hbox = Gtk.HBox()
image = Gtk.Image()
image.set_from_pixbuf(player.getIcon(size=24, gametype=gametype))
hbox.pack_start(image, False, False, 0)
label = Gtk.Label()
markup = player.getMarkup(gametype=gametype, long_titles=False)
label.set_markup(markup + heading_text)
hbox.pack_start(label, False, False, 0)
vbox = Gtk.VBox()
vbox.pack_start(hbox, False, False, 0)
label = Gtk.Label()
label.props.xalign = 0
label.props.xpad = 4
label.props.justify = Gtk.Justification.LEFT
label.props.wrap = True
label.set_width_chars(70)
label.set_text(message_text)
vbox.pack_start(label, False, False, 5)
return vbox
示例8: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def __init__(self):
Gtk.VBox.__init__(self, spacing=3, margin=5, vexpand=False)
## Plot options
self.plot_options_label = Gtk.Label(justify=Gtk.Justification.LEFT, xalign=0, margin_top=5)
self.plot_options_label.set_markup("<b>Plot Options:</b>")
self.pack_start(self.plot_options_label, expand=False, fill=True, padding=2)
grid0 = Gtk.Grid(column_spacing=3, row_spacing=2)
self.pack_start(grid0, expand=True, fill=False, padding=2)
# Plot CB
self.plot_cb = FCCheckBox(label='Plot')
grid0.attach(self.plot_cb, 0, 0, 2, 1)
# Tool dia for plot
l1 = Gtk.Label('Tool dia:', xalign=1)
grid0.attach(l1, 0, 1, 1, 1)
self.tooldia_entry = LengthEntry()
grid0.attach(self.tooldia_entry, 1, 1, 1, 1)
示例9: create_headerlabel
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def create_headerlabel(title):
''' Sets options for the treeview header'''
col_widget = Gtk.VBox()
col_widget.show()
col_label = Gtk.Label(label='<u>' + title + '</u>')
col_label.set_use_markup(True)
col_label.show()
col_widget.pack_start(col_label, True, True, 0)
#col_align.add(col_label)
'''col_entry = InputEntry()
col_entry.set_name('treeview-header-entry')
col_entry.show()
col_widget.pack_start(col_entry, True, True, 0)'''
return col_widget
示例10: _button_box
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def _button_box(self):
'''
Panel which includes buttons for manipulating the current treeview:
- add / delete
- move up / move down row
:return: vbox-panel
'''
vbox = Gtk.VBox(spacing=5)
for stock, handler, data, tooltip in (
(Gtk.STOCK_ADD, self.on_add_new_column, None, _('Add column')), # T: hoover tooltip
(Gtk.STOCK_DELETE, self.on_delete_column, None, _('Remove column')), # T: hoover tooltip
(Gtk.STOCK_GO_UP, self.on_move_column, -1, _('Move column ahead')), # T: hoover tooltip
(Gtk.STOCK_GO_DOWN, self.on_move_column, 1, _('Move column backward')), # T: hoover tooltip
):
button = IconButton(stock)
if data:
button.connect('clicked', handler, data)
else:
button.connect('clicked', handler)
button.set_tooltip_text(tooltip)
vbox.pack_start(button, False, True, 0)
vbox.show_all()
return vbox
示例11: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def __init__(self):
Gtk.InfoBar.__init__(self)
self.set_message_type(Gtk.MessageType.INFO)
title_label = Gtk.Label()
title_label.set_markup("<b>{}</b>".format(_("Template mode")))
title_label.set_alignment(0.0, 0.5)
msg_label = Gtk.Label()
msg_label.set_markup(_("You are currently editing a template."))
msg_label.set_alignment(0.0, 0.5)
vbox = Gtk.VBox(spacing=5)
vbox.pack_start(title_label, False, False, 0)
vbox.pack_start(msg_label, False, False, 0)
image = Gtk.Image.new_from_stock(Gtk.STOCK_DIALOG_INFO, Gtk.IconSize.DIALOG)
content = self.get_content_area()
content.pack_start(image, False, False, 0)
content.pack_start(vbox, False, False, 0)
self.show_all()
示例12: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def __init__(self):
Gtk.InfoBar.__init__(self)
self.title_label = Gtk.Label()
self.msg_label = Gtk.Label()
self.title_label.set_alignment(0.0, 0.5)
self.msg_label.set_alignment(0.0, 0.5)
vbox = Gtk.VBox(spacing=5)
vbox.pack_start(self.title_label, False, False, 0)
vbox.pack_start(self.msg_label, False, False, 0)
self.image = Gtk.Image()
content = self.get_content_area()
content.pack_start(self.image, False, False, 0)
content.pack_start(vbox, False, False, 0)
self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
self.connect("close", lambda x: self.hide())
self.connect("response", self.on_response)
示例13: get_view
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def get_view(self):
"""It's called from Preference. It creates the view and returns it"""
vbox = Gtk.VBox(False, 3)
# create columns
renderer = Gtk.CellRendererText()
renderer.set_property('editable', False)
column = Gtk.TreeViewColumn(_('Sensor'), renderer, text=0)
self._tree_view.append_column(column)
renderer = Gtk.CellRendererText()
renderer.set_property('editable', False)
column = Gtk.TreeViewColumn(_('Description'), renderer, text=1)
self._tree_view.append_column(column)
self._tree_view.expand_all()
sw = Gtk.ScrolledWindow()
sw.add_with_viewport(self._tree_view)
vbox.pack_start(sw, True, True, 0)
# add buttons
hbox = Gtk.HBox()
new_button = Gtk.Button.new_from_stock(Gtk.STOCK_NEW)
new_button.connect('clicked', self._on_edit_sensor)
hbox.pack_start(new_button, False, False, 0)
edit_button = Gtk.Button.new_from_stock(Gtk.STOCK_EDIT)
edit_button.connect('clicked', self._on_edit_sensor, False)
hbox.pack_start(edit_button, False, False, 1)
del_button = Gtk.Button.new_from_stock(Gtk.STOCK_DELETE)
del_button.connect('clicked', self._on_del_sensor)
hbox.pack_start(del_button, False, False, 2)
add_button = Gtk.Button.new_from_stock(Gtk.STOCK_ADD)
add_button.connect('clicked', self._on_add_sensor)
hbox.pack_end(add_button, False, False, 3)
vbox.pack_end(hbox, False, False, 1)
frame = Gtk.Frame.new(_('Sensors'))
frame.add(vbox)
return frame
示例14: create_about_tab
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def create_about_tab(self):
from gi.repository import Pango
page = Gtk.VBox()
page.show()
tv = Gtk.TextView()
tv.set_editable(False)
tv.set_cursor_visible(False)
tv.modify_font(Pango.FontDescription(MONOSPACE_FONT))
scroll = Gtk.ScrolledWindow()
scroll.add(tv)
page.pack_start(scroll, True, True, 0)
self.info = tv.get_buffer()
self.add_tab(page, 'Wall')
示例15: init
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import VBox [as 别名]
def init(self):
"""
Constructs the GUI, consisting of a text area, and
an Import and Clear buttons.
"""
from gi.repository import Gtk
# GUI setup:
self.set_tooltip(_("Enter text to import and then click\n"
"the Import button at bottom"))
# create
self.import_text = Gtk.TextView()
self.import_text.set_wrap_mode(Gtk.WrapMode.NONE)
self.import_text.set_editable(True)
import_button = Gtk.Button()
clear_button = Gtk.Button()
# layout
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.add(self.import_text)
buttonbox = Gtk.HButtonBox()
buttonbox.set_layout(Gtk.ButtonBoxStyle.SPREAD)
buttonbox.pack_start(clear_button, False, False, 0)
buttonbox.pack_start(import_button, False, False, 0)
vbox = Gtk.VBox()
vbox.pack_start(scrolled_window, True, True, 0)
vbox.pack_start(buttonbox, False, False, 0)
scrolled_window = self.gui.get_container_widget()
for widget in scrolled_window.get_children():
widget.destroy()
scrolled_window.add_with_viewport(vbox)
scrolled_window.get_children()[0].set_shadow_type(Gtk.ShadowType.NONE)
# bindings
actiongroup = Gtk.ActionGroup('GrampletImportActions')
actiongroup.add_actions([
('import', None, _("_Import"), '<Alt>i', None, self.run),
('clear', Gtk.STOCK_CLEAR, None, None, None, self.clear)])
import_button.set_related_action(actiongroup.get_action('import'))
clear_button.set_related_action(actiongroup.get_action('clear'))
# show
vbox.show_all()