如何建立本机小部件gtk3的父级

时间:2016-04-05 08:25:15

标签: python-2.7 gtk3

您好我正在寻找定义gtk3

中本机小部件的父级的方法

例如在Python中:

def herit_of( widget):

Gtk.image

print herit_of(Gtk.image)
>>> Gtk.Misc

Here's a link

2 个答案:

答案 0 :(得分:1)

如果想知道一个类的祖先是什么,那就有__mro__元组。

示例:

class Foo(object):
     pass

class Bar(Foo):
     pass

 print(Foo.__mro__)
 bar = Bar()
 print(bar.__class__.__mro__)    

答案 1 :(得分:0)

对我来说没问题。

测试代码如下

Dim rngData As Range
Dim intCounter As Integer
Dim rngToSelect As Range

Set rngData = ActiveCell.CurrentRegion

Set rngToSelect = Range(rngData.Cells(1, 1), rngData.Cells(rngData.Rows.Count, 1))
For intCounter = 1 To rngData.Columns.Count
    If rngData.Cells(1, intCounter).Value <> "Values" Then
        Set rngToSelect = Union(rngToSelect, Range(rngData.Cells(1, intCounter), rngData.Cells(rngData.Rows.Count, intCounter)))
    End If
Next intCounter

rngToSelect.Select

结果是

from gi.repository import Gtk

class Bar(Gtk.Window):
    pass


bar = Bar()
info= bar.__class__.__mro__
for element in info:
    print element

有了这些数据,我应该建立一个依赖树 很酷