- AMD Device Library eXtra
-
Programming with ADLX
- Overview
-
ADLX Programming Guide
-
ADLX Samples
- Overview
-
C++ Samples
- Overview
-
Display
- Display
- Display3DLUT
- DisplayBlanking
- DisplayColorDepth
- DisplayConnectivityExperience
- DisplayCustomColor
- DisplayCustomResolution
- DisplayEvents
- DisplayFreeSync
- DisplayGamma
- DisplayGamut
- DisplayGPUScaling
- DisplayHDCP
- DisplayInfo
- DisplayIntegerScaling
- DisplayPixelFormat
- DisplayScalingMode
- DisplayVariBright
- DisplayVSR
-
Performance Monitoring
-
Receiving Events Notifications
-
C Samples
- Overview
-
Display
- Display
- Display3DLUT
- DisplayBlanking
- DisplayColorDepth
- DisplayConnectivityExperience
- DisplayCustomColor
- DisplayCustomResolution
- DisplayEvents
- DisplayFreeSync
- DisplayGamma
- DisplayGamut
- DisplayGPUScaling
- DisplayHDCP
- DisplayInfo
- DisplayIntegerScaling
- DisplayPixelFormat
- DisplayScalingMode
- DisplayVariBright
- DisplayVSR
-
Performance Monitoring
-
Receiving Events Notifications
-
ADLX SDK References
- Overview
-
ADLX Helpers
-
ADLX Interfaces
- Overview
-
3D Graphics
- 3D Graphics
-
iadlx3danisotropicfiltering
-
iadlx3dantialiasing
-
iadlx3dframeratetargetcontrol
-
iadlx3dimagesharpening
-
iadlx3dradeonsuperresolution
-
iadlx3dsettingschangedevent
- IADLX3DSettingsChangedEvent
- GetGPU
- IsAnisotropicFilteringChanged
- IsAntiAliasingChanged
- IsAntiLagChanged
- IsBoostChanged
- IsChillChanged
- IsEnhancedSyncChanged
- IsFrameRateTargetControlChanged
- IsImageSharpeningChanged
- IsMorphologicalAntiAliasingChanged
- IsRadeonSuperResolutionChanged
- IsResetShaderCache
- IsTessellationModeChanged
- IsWaitForVerticalRefreshChanged
-
iadlx3dsettingschangedhandling
-
iadlx3dsettingsservices
-
Display
- Display
-
iadlxdisplay3dlut
- IADLXDisplay3DLUT
- ClearUser3DLUT
- GetAllUser3DLUT
- GetHDRUser3DLUT
- GetSCEDynamicContrast
- GetSCEDynamicContrastRange
- GetSDRUser3DLUT
- GetUser3DLUTIndex
- IsCurrentSCEDisabled
- IsCurrentSCEDynamicContrast
- IsCurrentSCEVividGaming
- IsSupportedSCE
- IsSupportedSCEDynamicContrast
- IsSupportedSCEVividGaming
- IsSupportedUser3DLUT
- SetAllUser3DLUT
- SetHDRUser3DLUT
- SetSCEDisabled
- SetSCEDynamicContrast
- SetSCEVividGaming
- SetSDRUser3DLUT
-
iadlxdisplay3dlutchangedevent
-
iadlxdisplayblanking
-
iadlxdisplaychangedhandling
- IADLXDisplayChangedHandling
- AddDisplay3DLUTEventListener
- AddDisplayGammaEventListener
- AddDisplayGamutEventListener
- AddDisplayListEventListener
- AddDisplaySettingsEventListener
- RemoveDisplay3DLUTEventListener
- RemoveDisplayGammaEventListener
- RemoveDisplayGamutEventListener
- RemoveDisplayListEventListener
- RemoveDisplaySettingsEventListener
-
iadlxdisplayconnectivityexperience
- IADLXDisplayConnectivityExperience
- GetDPLinkRate
- GetNumberOfActiveLanes
- GetNumberOfTotalLanes
- GetRelativePreEmphasis
- GetRelativeVoltageSwing
- IsEnabledHDMIQualityDetection
- IsEnabledLinkProtection
- IsSupportedDPLink
- IsSupportedHDMIQualityDetection
- SetEnabledHDMIQualityDetection
- SetRelativePreEmphasis
- SetRelativeVoltageSwing
-
iadlxdisplaycustomcolor
- IADLXDisplayCustomColor
- GetBrightness
- GetBrightnessRange
- GetContrast
- GetContrastRange
- GetHue
- GetHueRange
- GetSaturation
- GetSaturationRange
- GetTemperature
- GetTemperatureRange
- IsBrightnessSupported
- IsContrastSupported
- IsHueSupported
- IsSaturationSupported
- IsTemperatureSupported
- SetBrightness
- SetContrast
- SetHue
- SetSaturation
- SetTemperature
-
iadlxdisplaycustomresolution
-
iadlxdisplaygamma
- IADLXDisplayGamma
- GetGammaCoefficient
- GetGammaRamp
- IsCurrentDeGammaRamp
- IsCurrentReGamma36
- IsCurrentReGammaBT709
- IsCurrentRegammaCoefficient
- IsCurrentReGammaPQ
- IsCurrentReGammaPQ2084Interim
- IsCurrentReGammaRamp
- IsCurrentReGammaSRGB
- IsSupportedReGamma36
- IsSupportedReGammaBT709
- IsSupportedReGammaPQ
- IsSupportedReGammaPQ2084Interim
- IsSupportedReGammaSRGB
- ResetGammaRamp
- SetDeGammaRamp
- SetReGamma36
- SetReGammaBT709
- SetReGammaCoefficient
- SetReGammaPQ
- SetReGammaPQ2084Interim
- SetReGammaRamp
- SetReGammaSRGB
-
iadlxdisplaygammachangedevent
-
Miscellaneous
-
Performance Monitoring
-
Legal Information and Compliance/Disclaimers
DisplayEvents
Navigation: Programming with ADLX → ADLX Samples → Python Samples
Demontrates how to handle notifications about display change when programming with ADLX.
Sample Path
/Samples/python/DisplayEvents
Python
Code
Python
#<!--# Copyright (c) 2021 - 2025 Advanced Micro Devices, Inc. All rights reserved.##-------------------------------------------------------------------------------------------------#-->
import ADLXPybind as ADLXimport time
# Callback for display list changedef callBackDisplayList(displaylist)->bool: print("display list changed, current display count is: ", len(displaylist)) for index, display in enumerate(displaylist): name = display.name() print("\t index: {} name: {}".format(index, name)) del display return True
# Iterate display and display event to unplug and plug the displaydef displayDemo(): # Get ADLXHelp and ADLX initialization adlxHelper = ADLX.ADLXHelper() ret = adlxHelper.Initialize()
if ret == ADLX.ADLX_RESULT.ADLX_OK: # Get systemServices system = adlxHelper.GetSystemServices()
if system is not None: # Get displayServices displayService = system.GetDisplaysServices()
if displayService is not None: # Get display change handler displayChangeHandler = displayService.GetDisplayChangedHandling()
if displayChangeHandler is not None: # Python call back callback = ADLX.DisplayListCallBack() callback.call = callBackDisplayList # Add call back displayChangeHandler.AddDisplayListEventListener(callback) print("Plug or unplug a display within 20 seconds.") time.sleep(20) # Remove call back displayChangeHandler.RemoveDisplayListEventListener(callback)
# Release changeHandler interface del displayChangeHandler
# Release displayService interface del displayService
# Terminate ADLX ret = adlxHelper.Terminate() print("ADLX Terminate ret is: {}".format(ret))
displayDemo()