Clear clipboard?

Is it possible for python to clear the clipboard? If so ... how can I do this?

I need this so in my quiz program, students cannot copy paste responses from the Internet and other files.

EDIT: I am using WinXP and Python 2.6

+4
source share
2 answers
from ctypes import windll if windll.user32.OpenClipboard(None): windll.user32.EmptyClipboard() windll.user32.CloseClipboard() 

No external libraries are required.

+10
source

Yes, for this you need to use the PyWin32 module, which is the python module for Windows extent.

Take a look at your EmptyClipboard method .

The EmptyClipboard function empties the clipboard and frees data descriptors in the clipboard. The function then assigns the ownership of the clipboard to the window in which the clipboard is open.

+1
source

Source: https://habr.com/ru/post/1394530/


All Articles