本文整理汇总了Python中gtk.Window方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.Window方法的具体用法?Python gtk.Window怎么用?Python gtk.Window使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.Window方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: hello_world_window
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def hello_world_window():
"""
Create a GTK window with one 'Hello world' button.
"""
# Create a new window.
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_border_width(50)
# Create a new button with the label "Hello World".
button = gtk.Button("Hello World")
window.add(button)
# Clicking the button prints some text.
def clicked(data):
print("Button clicked!")
button.connect("clicked", clicked)
# Display the window.
button.show()
window.show()
示例2: on_key_press
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def on_key_press(self, window, event):
"""Handle a keyboard event"""
maker = Factory()
self.set_urgency_hint(False)
mapping = self.terminator.keybindings.lookup(event)
if mapping:
dbg('Window::on_key_press: looked up %r' % mapping)
if mapping == 'full_screen':
self.set_fullscreen(not self.isfullscreen)
elif mapping == 'close_window':
if not self.on_delete_event(window,
gtk.gdk.Event(gtk.gdk.DELETE)):
self.on_destroy_event(window,
gtk.gdk.Event(gtk.gdk.DESTROY))
elif mapping == 'new_tab':
self.tab_new(self.get_focussed_terminal())
else:
return(False)
return(True)
示例3: zoom
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def zoom(self, widget, font_scale=True):
"""Zoom a terminal widget"""
children = self.get_children()
if widget in children:
# This widget is a direct child of ours and we're a Window
# so zooming is a no-op
return
self.zoom_data = widget.get_zoom_data()
self.zoom_data['widget'] = widget
self.zoom_data['old_child'] = children[0]
self.zoom_data['font_scale'] = font_scale
self.remove(self.zoom_data['old_child'])
self.zoom_data['old_parent'].remove(widget)
self.add(widget)
self.set_property('term_zoomed', True)
if font_scale:
widget.cnxids.new(widget, 'size-allocate',
widget.zoom_scale, self.zoom_data)
widget.grab_focus()
示例4: unzoom
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def unzoom(self, widget):
"""Restore normal terminal layout"""
if not self.get_property('term_zoomed'):
# We're not zoomed anyway
dbg('Window::unzoom: not zoomed, no-op')
return
widget = self.zoom_data['widget']
if self.zoom_data['font_scale']:
widget.vte.set_font(self.zoom_data['old_font'])
self.remove(widget)
self.add(self.zoom_data['old_child'])
self.zoom_data['old_parent'].add(widget)
widget.grab_focus()
self.zoom_data = None
self.set_property('term_zoomed', False)
示例5: __vwActivated
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def __vwActivated(self, tree, path, column):
x = self.vwGetSelected(0)
if x == None:
return
print 'WOOT',x
import sys
import gtk
__import__(x)
mod = sys.modules[x]
b = vs_builder.VStructBuilder()
b.addVStructNamespace(self.vwGetSelected(2), mod)
bv = VStructBuilderView(b)
w = gtk.Window()
w.add(bv)
w.show_all()
示例6: createPanelSettingsWidgets
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def createPanelSettingsWidgets(self):
"""Create the Panel Settings widgets."""
self.tablePanelSettings = gtk.Table(rows=5, columns=3, homogeneous=False)
self.tablePanelSettings.set_row_spacings(5)
self.tablePanelSettings.set_col_spacings(5)
createLabel(self.tablePanelSettings, text="Window Manager Menu", gridX=0, gridY=0, xPadding=10)
self.panelMenu = createCheckButton(self.tablePanelSettings, active=False, gridX=1, gridY=0, xExpand=True, yExpand=False, handler=self.changeOccurred)
self.registerComponent("wm_menu", self.panelMenu)
createLabel(self.tablePanelSettings, text="Place In Window Manager Dock", gridX=0, gridY=1, xPadding=10)
self.panelDock = createCheckButton(self.tablePanelSettings, active=False, gridX=1, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred)
self.registerComponent("panel_dock", self.panelDock)
createLabel(self.tablePanelSettings, text="Panel Layer", gridX=0, gridY=2, xPadding=10)
self.panelLayer = createComboBox(self.tablePanelSettings, ["bottom", "top", "normal"], gridX=1, gridY=2, handler=self.changeOccurred)
self.registerComponent("panel_layer", self.panelLayer)
createLabel(self.tablePanelSettings, text="Strut Policy", gridX=0, gridY=3, xPadding=10)
self.panelAutohideStrut = createComboBox(self.tablePanelSettings, ["none", "minimum", "follow_size"], gridX=1, gridY=3, handler=self.changeOccurred)
self.registerComponent("strut_policy", self.panelAutohideStrut)
createLabel(self.tablePanelSettings, text="Panel Monitor (all, 1, 2, ...)", gridX=0, gridY=4, xPadding=10)
self.panelMonitor = createEntry(self.tablePanelSettings, maxSize=6, width=8, text=PANEL_MONITOR, gridX=1, gridY=4, xExpand=True, yExpand=False, handler=self.changeOccurred)
self.registerComponent("panel_monitor", self.panelMonitor)
示例7: run
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [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()
示例8: _start_shell
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def _start_shell(self, dummy_button):
if self.shell_window is not None:
self.shell_window.present()
return
self.shell_window = gtk.Window()
self.shell_window.set_size_request(750,550)
self.shell_window.set_resizable(True)
scrolled_window = gtk.ScrolledWindow()
scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
ipython = ipython_view.IPythonView()
ipython.modify_font(pango.FontDescription(SHELL_FONT))
ipython.set_wrap_mode(gtk.WRAP_CHAR)
ipython.show()
scrolled_window.add(ipython)
scrolled_window.show()
self.shell_window.add(scrolled_window)
self.shell_window.show()
self.shell_window.connect('destroy', self._on_shell_window_destroy)
self._update_ipython_selected_node()
__IPYTHON__.user_ns['viz'] = self
示例9: _start_shell
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def _start_shell(self, dummy_button):
if self.shell_window is not None:
self.shell_window.present()
return
self.shell_window = gtk.Window()
self.shell_window.set_size_request(750,550)
self.shell_window.set_resizable(True)
scrolled_window = gtk.ScrolledWindow()
scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
self.ipython = ipython_view.IPythonView()
self.ipython.modify_font(pango.FontDescription(SHELL_FONT))
self.ipython.set_wrap_mode(gtk.WRAP_CHAR)
self.ipython.show()
scrolled_window.add(self.ipython)
scrolled_window.show()
self.shell_window.add(scrolled_window)
self.shell_window.show()
self.shell_window.connect('destroy', self._on_shell_window_destroy)
self._update_ipython_selected_node()
self.ipython.updateNamespace({'viz': self})
示例10: edit_recarray
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def edit_recarray(r, formatd=None, stringd=None, constant=None, autowin=True):
"""
create a RecListStore and RecTreeView and return them.
If autowin is True, create a gtk.Window, insert the treeview into
it, and return it (return value will be (liststore, treeview, win)
See RecListStore and RecTreeView for a description of the keyword args
"""
liststore = RecListStore(r, formatd=formatd, stringd=stringd)
treeview = RecTreeView(liststore, constant=constant)
if autowin:
win = gtk.Window()
win.add(treeview)
win.show_all()
return liststore, treeview, win
else:
return liststore, treeview
示例11: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def __init__(self, n, front, back, trunk, trunk_stroke, grains,
steps_itt, step):
Render.__init__(self, n, front, back, trunk, trunk_stroke, grains)
window = gtk.Window()
window.resize(self.n, self.n)
self.steps_itt = steps_itt
self.step = step
window.connect("destroy", self.__destroy)
darea = gtk.DrawingArea()
darea.connect("expose-event", self.expose)
window.add(darea)
window.show_all()
self.darea = darea
self.steps = 0
gobject.idle_add(self.step_wrap)
示例12: _create_field_tooltip
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def _create_field_tooltip(self):
self._field_tooltip_window = gtk.Window(type=gtk.WINDOW_POPUP)
self._field_tooltip_window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP)
self._field_tooltip_window.set_resizable(False)
# This copies the style of GTK tooltips.
self._field_tooltip_window.set_name("gtk-tooltips")
self._field_tooltip_text = gtk.Label()
self._field_tooltip_hbox = gtk.HBox(homogeneous=False)
self._field_tooltip_hbox.pack_start(
self._field_tooltip_text, expand=False, fill=False)
self._field_tooltip_frame = gtk.Frame()
self._field_tooltip_frame.set_shadow_type(gtk.SHADOW_ETCHED_IN)
self._field_tooltip_frame.add(self._field_tooltip_hbox)
self._field_tooltip_frame.show_all()
self._field_tooltip_window.add(self._field_tooltip_frame)
示例13: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Window [as 别名]
def __init__(self):
"""Class initialiser"""
self.terminator = Terminator()
self.terminator.register_window(self)
Container.__init__(self)
gtk.Window.__init__(self)
gobject.type_register(Window)
self.register_signals(Window)
self.set_property('allow-shrink', True)
icon_to_apply=''
self.register_callbacks()
self.apply_config()
self.title = WindowTitle(self)
self.title.update()
options = self.config.options_get()
if options:
if options.forcedtitle:
self.title.force_title(options.forcedtitle)
if options.role:
self.set_role(options.role)
if options.classname is not None:
self.set_wmclass(options.classname, self.wmclass_class)
if options.forcedicon is not None:
icon_to_apply = options.forcedicon
if options.geometry:
if not self.parse_geometry(options.geometry):
err('Window::__init__: Unable to parse geometry: %s' %
options.geometry)
self.apply_icon(icon_to_apply)
self.pending_set_rough_geometry_hint = False