Phoenix Logo

phoenix_title wx.PlatformInformation

This class holds information about the operating system, the toolkit and the basic architecture of the machine where the application is currently running.

This class does not only have getters for the information above, it also has setters. This allows you to e.g. save the current platform information in a data file (maybe in string form) so that when you later load it, you can easily retrieve (see the static getters for string.enum conversion functions) and store inside a PlatformInfo instance (using its setters) the signature of the system which generated it.

In general however you only need to use the static Get function and then access the various information for the current platform:

wx.LogMessage("This application is running under %s." % wx.PlatformInformation.Get().GetOperatingSystemIdName())

class_hierarchy Class Hierarchy

Inheritance diagram for class PlatformInformation:


method_summary Methods Summary

__init__ Initializes the instance with the values corresponding to the currently running platform.
CheckOSVersion Returns True if the OS version is at least major.minor .
CheckToolkitVersion Returns True if the toolkit version is at least major.minor .
Get Returns the global PlatformInfo object, initialized with the values for the currently running platform.
GetArch Converts the given string to a Architecture enum value or to ARCH_INVALID if the given string is not a valid architecture string (i.e.
GetArchName Returns the name for the architecture of this PlatformInfo instance.
GetArchitecture Returns the architecture ID of this PlatformInfo instance.
GetDesktopEnvironment Returns the desktop environment associated with this PlatformInfo instance.
GetEndianness Returns the endianness ID of this PlatformInfo instance.
GetEndiannessName Returns the name for the endianness of this PlatformInfo instance.
GetLinuxDistributionInfo Returns the Linux distribution info associated with this PlatformInfo instance.
GetOSMajorVersion Returns the run-time major version of the OS associated with this PlatformInfo instance.
GetOSMinorVersion Returns the run-time minor version of the OS associated with this PlatformInfo instance.
GetOperatingSystemDescription Returns the description of the operating system of this PlatformInfo instance.
GetOperatingSystemDirectory Returns the operating system directory.
GetOperatingSystemFamilyName Returns the operating system family name of the OS associated with this PlatformInfo instance.
GetOperatingSystemId Returns the operating system ID of this PlatformInfo instance.
GetOperatingSystemIdName Returns the operating system name of the OS associated with this PlatformInfo instance.
GetPortId Returns the wxWidgets port ID associated with this PlatformInfo instance.
GetPortIdName Returns the name of the wxWidgets port ID associated with this PlatformInfo instance.
GetPortIdShortName Returns the short name of the wxWidgets port ID associated with this PlatformInfo instance.
GetToolkitMajorVersion Returns the run-time major version of the toolkit associated with this PlatformInfo instance.
GetToolkitMinorVersion Returns the run-time minor version of the toolkit associated with this PlatformInfo instance.
IsOk Returns True if this instance is fully initialized with valid values.
IsUsingUniversalWidgets Returns True if this PlatformInfo describes wxUniversal build.
SetArchitecture Sets the architecture enum value associated with this PlatformInfo instance.
SetDesktopEnvironment Sets the desktop environment associated with this PlatformInfo instance.
SetEndianness Sets the endianness enum value associated with this PlatformInfo instance.
SetLinuxDistributionInfo Sets the linux distribution info associated with this PlatformInfo instance.
SetOSVersion Sets the version of the operating system associated with this PlatformInfo instance.
SetOperatingSystemDescription Sets the operating system description associated with this PlatformInfo instance.
SetOperatingSystemId Sets the operating system associated with this PlatformInfo instance.
SetPortId Sets the wxWidgets port ID associated with this PlatformInfo instance.
SetToolkitVersion Sets the version of the toolkit associated with this PlatformInfo instance.
__ne__ Inequality operator.
__eq__ Equality operator.

api Class API



class wx.PlatformInformation(object)

PlatformInfo() PlatformInfo(pid, tkMajor=-1, tkMinor=-1, id=OS_UNKNOWN, osMajor=-1, osMinor=-1, arch=ARCH_INVALID, endian=ENDIAN_INVALID)

This class holds information about the operating system, the toolkit and the basic architecture of the machine where the application is currently running.


Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Initializes the instance with the values corresponding to the currently running platform.

This is a fast operation because it only requires to copy the values internally cached for the currently running platform.

See also

Get



__init__ (self, pid, tkMajor=-1, tkMinor=-1, id=OS_UNKNOWN, osMajor=-1, osMinor=-1, arch=ARCH_INVALID, endian=ENDIAN_INVALID)

Initializes the object using given values.

Parameters:





CheckOSVersion(self, major, minor)

Returns True if the OS version is at least major.minor .

Parameters:
  • major (int) –
  • minor (int) –
Return type:

bool



CheckToolkitVersion(self, major, minor)

Returns True if the toolkit version is at least major.minor .

Parameters:
  • major (int) –
  • minor (int) –
Return type:

bool



static Get()

Returns the global PlatformInfo object, initialized with the values for the currently running platform.

Return type:PlatformInfo


static GetArch(arch)

Converts the given string to a Architecture enum value or to ARCH_INVALID if the given string is not a valid architecture string (i.e.

does not contain nor 32 nor 64 strings).

Parameters:arch (string) –
Return type: wx.Architecture


GetArchName(self)

Returns the name for the architecture of this PlatformInfo instance.

Return type:string


GetArchitecture(self)

Returns the architecture ID of this PlatformInfo instance.

Return type: wx.Architecture


GetDesktopEnvironment(self)

Returns the desktop environment associated with this PlatformInfo instance.

See wx.AppTraits.GetDesktopEnvironment for more info.

Return type:string


GetEndianness(self)

Returns the endianness ID of this PlatformInfo instance.

Return type: wx.Endianness


GetEndiannessName(self)

Returns the name for the endianness of this PlatformInfo instance.

Return type:string


GetLinuxDistributionInfo(self)

Returns the Linux distribution info associated with this PlatformInfo instance.

See wx.GetLinuxDistributionInfo for more info.

Return type: wx.LinuxDistributionInfo


GetOSMajorVersion(self)

Returns the run-time major version of the OS associated with this PlatformInfo instance.

Return type:int


GetOSMinorVersion(self)

Returns the run-time minor version of the OS associated with this PlatformInfo instance.

Return type:int


GetOperatingSystemDescription(self)

Returns the description of the operating system of this PlatformInfo instance.

See wx.GetOsDescription for more info.

Return type:string


static GetOperatingSystemDirectory()

Returns the operating system directory.

See GetOSDirectory for more info.

Return type:string


GetOperatingSystemFamilyName(self)

Returns the operating system family name of the OS associated with this PlatformInfo instance.

Return type:string


GetOperatingSystemId(self)

Returns the operating system ID of this PlatformInfo instance.

See wx.GetOsVersion for more info.

Return type: wx.OperatingSystemId


GetOperatingSystemIdName(self)

Returns the operating system name of the OS associated with this PlatformInfo instance.

Return type:string


GetPortId(self)

Returns the wxWidgets port ID associated with this PlatformInfo instance.

Return type: wx.PortId


GetPortIdName(self)

Returns the name of the wxWidgets port ID associated with this PlatformInfo instance.

Return type:string


GetPortIdShortName(self)

Returns the short name of the wxWidgets port ID associated with this PlatformInfo instance.

Return type:string


GetToolkitMajorVersion(self)

Returns the run-time major version of the toolkit associated with this PlatformInfo instance.

Note that if GetPortId returns PORT_BASE , then this value is zero (unless externally modified with SetToolkitVersion ); that is, no native toolkit is in use. See wx.AppTraits.GetToolkitVersion for more info.

Return type:int


GetToolkitMinorVersion(self)

Returns the run-time minor version of the toolkit associated with this PlatformInfo instance.

Note that if GetPortId returns PORT_BASE , then this value is zero (unless externally modified with SetToolkitVersion ); that is, no native toolkit is in use. See wx.AppTraits.GetToolkitVersion for more info.

Return type:int


IsOk(self)

Returns True if this instance is fully initialized with valid values.

Return type:bool


IsUsingUniversalWidgets(self)

Returns True if this PlatformInfo describes wxUniversal build.

Return type:bool


SetArchitecture(self, n)

Sets the architecture enum value associated with this PlatformInfo instance.

Parameters:n (Architecture) –


SetDesktopEnvironment(self, de)

Sets the desktop environment associated with this PlatformInfo instance.

Parameters:de (string) –


SetEndianness(self, n)

Sets the endianness enum value associated with this PlatformInfo instance.

Parameters:n (Endianness) –


SetLinuxDistributionInfo(self, di)

Sets the linux distribution info associated with this PlatformInfo instance.

Parameters:di (wx.LinuxDistributionInfo) –


SetOSVersion(self, major, minor)

Sets the version of the operating system associated with this PlatformInfo instance.

Parameters:
  • major (int) –
  • minor (int) –


SetOperatingSystemDescription(self, desc)

Sets the operating system description associated with this PlatformInfo instance.

Parameters:desc (string) –


SetOperatingSystemId(self, n)

Sets the operating system associated with this PlatformInfo instance.

Parameters:n (OperatingSystemId) –


SetPortId(self, n)

Sets the wxWidgets port ID associated with this PlatformInfo instance.

Parameters:n (PortId) –


SetToolkitVersion(self, major, minor)

Sets the version of the toolkit associated with this PlatformInfo instance.

Parameters:
  • major (int) –
  • minor (int) –


__ne__(self)

Inequality operator.

Tests all class’ internal variables.

Parameters:t (PlatformInfo) –


__eq__(self)

Equality operator.

Tests all class’ internal variables.

Parameters:t (PlatformInfo) –

Properties



ArchName

See GetArchName



Architecture

See GetArchitecture and SetArchitecture



DesktopEnvironment

See GetDesktopEnvironment and SetDesktopEnvironment



Endianness

See GetEndianness and SetEndianness



EndiannessName

See GetEndiannessName



LinuxDistributionInfo

See GetLinuxDistributionInfo and SetLinuxDistributionInfo



OSMajorVersion

See GetOSMajorVersion



OSMinorVersion

See GetOSMinorVersion



OperatingSystemDescription

See GetOperatingSystemDescription and SetOperatingSystemDescription



OperatingSystemFamilyName

See GetOperatingSystemFamilyName



OperatingSystemId

See GetOperatingSystemId and SetOperatingSystemId



OperatingSystemIdName

See GetOperatingSystemIdName



PortId

See GetPortId and SetPortId



PortIdName

See GetPortIdName



PortIdShortName

See GetPortIdShortName



ToolkitMajorVersion

See GetToolkitMajorVersion



ToolkitMinorVersion

See GetToolkitMinorVersion