0

I want to take screenshot of the screen while one vscode tab is open(for example on the screen there is a text file) and when I'm done, I want to switch to a different tab and take screenshot of the screen. How can I switch between vscode editor tabs using python code if possible?

1
  • You should know that creating screenshots of text is one of the sore spots of many SO users. Commented Jul 14, 2022 at 12:06

1 Answer 1

2

In Vscode, we can use :

  1. Alt + number

  2. Ctrl + Tab

to switch to different tabs. When running the following code, Ctrl key will keep pressed until finish, and using Tab and Enter key, we can switch to different tabs.

from pykeyboard import PyKeyboard
import time

k = PyKeyboard()
num = 5 # num of tabs
k.press_key(k.control_key)
for i in range(num):
    k.tap_key(k.tab_key, n=i+1, interval=1)
    k.tap_key(k.enter_key)
    time.sleep(10)
k.release_key(k.control_key)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.