ports.PortReference
- class ports.PortReference(port: Optional[int] = None, expected_type: Optional[type] = None)
Base class for port references.
If the
portparameter is not supplied, then the port will be inferred. An inference will only succeed if there is exactly one port assigned to a reference of typeexpected_type. Ifexpected_typeisNone, inference only succeeds if exactly one port is assigned. For the purpose of inference, theself()is not assigned to a port and will never be inferred.- name() str
Returns the user editable name of the controllable as found in the properties tab of the game.
from ports import PortReference print(PortReference(0).name())