Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.64 KB

winsdk.rst

File metadata and controls

55 lines (40 loc) · 1.64 KB

winsdk.system module

A wrapper around the WinRT System.Object type.

This is the base type of all WinRT runtime objects and cannot be instantiated directly.

This type currently has no members.

A wrapper around the WinRT System.Array type.

This type implements the Python sequence protocol.

param type

The type to use for elements of the array. This can be a WinRT type or a format string for fundamental types.

type type

str or type

param initializer

An optional iterator of values to use to initialize the array. If an integer value is given, an empty array of that size will be initialized. For value types, any object supporting the CPython buffer protocol with the correct layout can be used as an initializer.

type initializer

int or iter or buffer

Creation examples:

from winsdk import Array
from winsdk.windows.foundation import Point

# array of 10 32-bit unsigned integers.
a1 = Array("I", 10)
# array of 3 points with initial values
a2 = Array(Point, [Point(1, 1), Point(2, 2), Point(3, 3)])

Sequence protocol examples:

# get the number of elements in the array
size = len(a1)
# get the first element of the array
item = a1[0]
# get the last element of the array
item = a1[-1]
# iterate all items of the array
for item in a1: ...
# test for element in array
if item in a1: ...