Is there a way I can modify the opacity of cmd with Python

Viewed 151

I'm currently using Python to design a console app and thought it would look nice to use a different cmd opacity.

I was looking into cmd commands to see if there was something similar to color so that I could do os.system(command), but I wasn't able to find anything.

Are there any ways? Thanks.

1 Answers

Since I wasn't able to find a library that handled cmd functions, I tried the next best thing I could think of. It's not a clean solution and I hope to mark the next best answer as a solution in the future, but for now I was able to use this:

import pyautogui

# 90% Transparency
for _ in range(1):
    pyautogui.hotkey("ctrl", "shift", "-")

# 80% Transparency
for _ in range(2):
    pyautogui.hotkey("ctrl", "shift", "-")

# 70% Transparency
for _ in range(3):
    pyautogui.hotkey("ctrl", "shift", "-")

# 60% Transparency
for _ in range(4):
    pyautogui.hotkey("ctrl", "shift", "-")

# and so on

This may not work if the user also switches out of the application immediately, but I have not tested that yet.

Related