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


Python Structure.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        self.__enums = dict((f, t) for f, t in self._fields_
                            if issubclass_(t, Enum))
        for field, val in iteritems(self._defaults_):
            setattr(self, field, val)

        Structure.__init__(self, *args, **kwargs)
开发者ID:dougalsutherland,项目名称:sdm,代码行数:9,代码来源:sdm_ctypes.py

示例2: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__ (self, pixel, line, x, y, z = 0.0):
     Structure.__init__(self)
     self.pixel = pixel
     self.line  = line
     self.x     = x
     self.y     = y
     self.z     = 0.0
开发者ID:aaronr,项目名称:labs-rectifier,代码行数:9,代码来源:gdalwarp.py

示例3: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__(self, **kwargs):
     Structure.__init__(self)
     self.cbSize = sizeof(self)
     for field_name, field_value in kwargs.items():
         if isinstance(field_value, string_types):
             field_value = ensure_binary(field_value)
         setattr(self, field_name, field_value)
开发者ID:alanhdu,项目名称:conda,代码行数:9,代码来源:windows.py

示例4: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__(self, text):
     if isinstance(text, str):
         text = text.encode(sys.getdefaultencoding())
     elif not isinstance(text, bytes):
         msg = "dbm mapping keys must be a string or bytes object, not {!r}"
         raise TypeError(msg.format(type(text).__name__))
     Structure.__init__(self, text, len(text))
开发者ID:timm,项目名称:timmnix,代码行数:9,代码来源:_dbm.py

示例5: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__(self, pmid, typeof, indom, sem, units):
     Structure.__init__(self)
     self.m_user = None
     self.m_desc.pmid = pmid
     self.m_desc.type = typeof
     self.m_desc.indom = indom
     self.m_desc.sem = sem
     self.m_desc.units = units
开发者ID:tongfw,项目名称:pcp,代码行数:10,代码来源:pmda.py

示例6: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__(self, *_args):
     Structure.__init__(self)
     #
     # Need to bind the following to the instance so it is available in
     #  `__del__()` when the interpreter shuts down.
     #
     self._free_chip_name = _free_chip_name
     self.byref = byref
开发者ID:178518,项目名称:netdata,代码行数:10,代码来源:lm_sensors.py

示例7: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__(self, serial, shorttext = '', helptext = ''):
     Structure.__init__(self)
     if type(helptext) != type(b''):
         helptext = helptext.encode('utf-8')
     if type(shorttext) != type(b''):
         shorttext = shorttext.encode('utf-8')
     self.shorttext = shorttext
     self.helptext = shorttext
     self.serial = serial
开发者ID:taintedkernel,项目名称:pcp,代码行数:11,代码来源:mmv.py

示例8: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
    def __init__(self, virtual_keycode, down):
        scancode = windll.user32.MapVirtualKeyA(virtual_keycode, 0)

        flags = 0
        if not down:
            flags |= win32con.KEYEVENTF_KEYUP
        if virtual_keycode in self.extended_keys:
            flags |= win32con.KEYEVENTF_EXTENDEDKEY

        extra = pointer(c_ulong(0))
        Structure.__init__(self, virtual_keycode, scancode, flags, 0, extra)
开发者ID:523brain,项目名称:dragonfly,代码行数:13,代码来源:sendinput.py

示例9: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__(self, value=None, max_length=0):
     strbuf = None
     length = 0
     if value is not None or max_length > 0:
         length = len(value)
         max_length = max(length, max_length)
         if value:
             strbuf = create_unicode_buffer(value, max_length)
         else:
             strbuf = create_unicode_buffer(max_length)
     Structure.__init__(self, length * 2, max_length * 2,
                        cast(strbuf, LPWSTR))
开发者ID:transformersprimeabcxyz,项目名称:e3-core-AdaCore,代码行数:14,代码来源:native_api.py

示例10: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__(self, name, item, typeof, semantics, dimension, indom = 0, shorttext = '', helptext = ''):
     Structure.__init__(self)
     if type(name) != type(b''):
         name = name.encode('utf-8')
     if type(helptext) != type(b''):
         helptext = helptext.encode('utf-8')
     if type(shorttext) != type(b''):
         shorttext = shorttext.encode('utf-8')
     self.shorttext = shorttext
     self.helptext = shorttext
     self.typeof = typeof
     self.indom = indom
     self.item = item
开发者ID:aeg-aeg,项目名称:pcpfans,代码行数:15,代码来源:mmv.py

示例11: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
    def __init__(self, **kwargs):
        """
        Ctypes.Structure with integrated default values.
        https://stackoverflow.com/questions/7946519/default-values-in-a-ctypes-structure/25892189#25892189

        :param kwargs: values different to defaults
        :type kwargs: dict
        """

        # sanity checks
        defaults = type(self)._defaults_
        assert type(defaults) is types.DictionaryType

        # use defaults, but override with keyword arguments, if any
        values = defaults.copy()
        for (key, val) in kwargs.items():
            values[key] = val

        # appropriately initialize ctypes.Structure
        #super().__init__(**values)                     # Python 3 syntax
        return Structure.__init__(self, **values)       # Python 2 syntax
开发者ID:hiveeyes,项目名称:kotori,代码行数:23,代码来源:backend_ctypes.py

示例12: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__(self, **kw):
     self.r1 = Mat4.rowtype(*(kw.get('r1') or (1,0,0,0)))
     self.r2 = Mat4.rowtype(*(kw.get('r2') or (0,1,0,0)))
     self.r3 = Mat4.rowtype(*(kw.get('r3') or (0,0,1,0)))
     self.r4 = Mat4.rowtype(*(kw.get('r4') or (0,0,0,1)))
     Structure.__init__(self)
开发者ID:gabdube,项目名称:python-vulkan-triangle,代码行数:8,代码来源:xmath.py

示例13: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__(self, categoryBits=0x1, maskBits=0xFFFF, groupIndex=0):
     """ Initialize the filter with the proper defaults """
     Structure.__init__(self, categoryBits=categoryBits, maskBits=maskBits, groupIndex=groupIndex)
开发者ID:cloew,项目名称:NytramBox2D,代码行数:5,代码来源:filter.py

示例14: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__(self):
     Structure.__init__(self, 512+9*4)
开发者ID:wpjunior,项目名称:telecentros,代码行数:4,代码来源:utils.py

示例15: __init__

# 需要导入模块: from ctypes import Structure [as 别名]
# 或者: from ctypes.Structure import __init__ [as 别名]
 def __init__(self, **kwargs):
     """ Initialize the Fixture Def """
     if "filter" not in kwargs:
         kwargs["filter"] = Filter()
     
     Structure.__init__(self, **kwargs)
开发者ID:cloew,项目名称:NytramBox2D,代码行数:8,代码来源:fixture_def.py


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