当前位置: 首页>>代码示例>>Python>>正文


Python gtk.Widget方法代码示例

本文整理汇总了Python中gtk.Widget方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.Widget方法的具体用法?Python gtk.Widget怎么用?Python gtk.Widget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gtk的用法示例。


在下文中一共展示了gtk.Widget方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _cb_expose_event

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Widget [as 别名]
def _cb_expose_event(self, widget, event):
        """
        This method is called when an instance of Chart receives
        the gtk expose_event.
        
        @type widget: gtk.Widget
        @param widget: The widget that received the event.
        @type event: gtk.Event
        @param event: The event.
        """
        self.context = widget.window.cairo_create()
        self.context.rectangle(event.area.x, event.area.y, \
                                event.area.width, event.area.height)
        self.context.clip()
        self.draw(self.context)
        return False 
开发者ID:OpenXenManager,项目名称:openxenmanager,代码行数:18,代码来源:chart.py

示例2: signal_buttonPressEvent

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Widget [as 别名]
def signal_buttonPressEvent(self, widget, eventButton, unused_data):
        if eventButton.type == GDK._2BUTTON_PRESS:
            if self.parent.canvas.visages.has_key(self.explorer.id):
                visage = self.parent.canvas.visages[self.explorer.id]
            else:
                visage = self.explorer.newVisage(self.parent.rootGroup,
                                                 self.parent.canvas)
            (x, y, w, h) = self.get_allocation()
            wx, wy = self.parent.canvas.c2w(x, y)

            x1, y1, x2, y2 = self.parent.get_bounds()

            v_x1, v_y1, v_x2, v_y2 = visage.get_bounds()

            visage.move(x2 - v_x1, wy + y1 - v_y1)


#### Widget-specific subclasses of Explorer, Visage, and Attribute

# Instance 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:22,代码来源:spelunk_gnome.py

示例3: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Widget [as 别名]
def __init__(self, dheight=300, dwidth=20):
        self._dheight = dheight
        self._dwidth = dwidth
        gtk.Widget.__init__(self)
        self._layout = self.create_pango_layout("") 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:7,代码来源:__init__.py

示例4: onKeyPressExtend

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Widget [as 别名]
def onKeyPressExtend(self, event):
    '''
    Key press callback with plenty of shell goodness, like history, 
    autocompletions, etc.
    
    @param widget: Widget that key press occured in.
    @type widget: gtk.Widget
    @param event: Event object.
    @type event: gtk.gdk.Event
    
    @return: True if event should not trickle.
    @rtype: boolean
    '''

    if event.state & gtk.gdk.CONTROL_MASK and event.keyval == 99:
      self.interrupt = True
      self._processLine()
      return True
    elif event.keyval == gtk.keysyms.Return:
      self._processLine()
      return True
    elif event.keyval == gtk.keysyms.Up:
      self.changeLine(self.historyBack())
      return True
    elif event.keyval == gtk.keysyms.Down:
      self.changeLine(self.historyForward())
      return True
    elif event.keyval == gtk.keysyms.Tab:
      if not self.getCurrentLine().strip():
        return False
      completed, possibilities = self.complete(self.getCurrentLine())
      if len(possibilities) > 1:
        slice = self.getCurrentLine()
        self.write('\n')
        for symbol in possibilities:
          self.write(symbol+'\n')
        self.showPrompt(self.prompt)
      self.changeLine(completed or slice)
      return True 
开发者ID:imec-idlab,项目名称:IEEE-802.11ah-ns-3,代码行数:41,代码来源:ipython_view.py

示例5: newAttributeWidget

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Widget [as 别名]
def newAttributeWidget(self, group):
        """Make a new attribute item for my object.

        Returns a gtk.Widget.
        """
        klass = spelunkerClassTable.get(self.explorerClass, None)
        if (not klass) or (klass[1] is None):
            log.msg("%s not in table, using generic" % self.explorerClass)
            klass = GenericAttributeWidget
        else:
            klass = klass[1]

        return klass(self, group) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:15,代码来源:spelunk_gnome.py

示例6: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Widget [as 别名]
def __init__(self, explorer, parent):
        """A new AttributeWidget describing an explorer.
        """
        self.parent = parent

        self.explorer = explorer
        self.identifier = explorer.identifier
        self.id = explorer.id

        widgetObj = self._makeWidgetObject()
        gtk.Widget.__init__(self, _obj=widgetObj)
        self.set_name("AttributeValue")
        self.connect("destroy", self.signal_destroy, None)
        self.connect("button-press-event", self.signal_buttonPressEvent,
                     None) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:17,代码来源:spelunk_gnome.py

示例7: get_toplevel_window

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Widget [as 别名]
def get_toplevel_window(widget):
  """
  Return the toplevel window (`gtk.Window`) for the specified widget
  (`gtk.Widget`). If the widget has no toplevel window, return None.
  """
  toplevel_widget = widget.get_toplevel()
  if toplevel_widget.flags() & gtk.TOPLEVEL:
    return toplevel_widget
  else:
    return None 
开发者ID:khalim19,项目名称:gimp-plugin-export-layers,代码行数:12,代码来源:utils.py

示例8: onKeyPress

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Widget [as 别名]
def onKeyPress(self, widget, event):
    '''
    Key press callback used for correcting behavior for console-like 
    interfaces. For example 'home' should go to prompt, not to begining of
    line.
    
    @param widget: Widget that key press accored in.
    @type widget: gtk.Widget
    @param event: Event object
    @type event: gtk.gdk.Event
    
    @return: Return True if event should not trickle.
    @rtype: boolean
    '''
    insert_mark = self.text_buffer.get_insert()
    insert_iter = self.text_buffer.get_iter_at_mark(insert_mark)
    selection_mark = self.text_buffer.get_selection_bound()
    selection_iter = self.text_buffer.get_iter_at_mark(selection_mark)
    start_iter = self.text_buffer.get_iter_at_mark(self.line_start)
    if event.keyval == gtk.keysyms.Home:
      if event.state & gtk.gdk.CONTROL_MASK or event.state & gtk.gdk.MOD1_MASK:
        pass
      elif event.state & gtk.gdk.SHIFT_MASK:
        self.text_buffer.move_mark(insert_mark, start_iter)
        return True
      else:
        self.text_buffer.place_cursor(start_iter)
        return True
    elif event.keyval == gtk.keysyms.Left:
      insert_iter.backward_cursor_position()
      if not insert_iter.editable(True):
        return True
    elif not event.string:
      pass
    elif start_iter.compare(insert_iter) <= 0 and \
          start_iter.compare(selection_iter) <= 0:
      pass
    elif start_iter.compare(insert_iter) > 0 and \
          start_iter.compare(selection_iter) > 0:
      self.text_buffer.place_cursor(start_iter)
    elif insert_iter.compare(selection_iter) < 0:
      self.text_buffer.move_mark(insert_mark, start_iter)
    elif insert_iter.compare(selection_iter) > 0:
      self.text_buffer.move_mark(selection_mark, start_iter)             

    return self.onKeyPressExtend(event) 
开发者ID:imec-idlab,项目名称:IEEE-802.11ah-ns-3,代码行数:48,代码来源:ipython_view.py


注:本文中的gtk.Widget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。