Is it possible for python to clear the clipboard? If so ... how can I do it?
I need this so in my quiz program, students can't copy paste answers from the internet and other files.
EDIT: Im using WinXP and Python 2.6
from ctypes import windll
if windll.user32.OpenClipboard(None):
windll.user32.EmptyClipboard()
windll.user32.CloseClipboard()
No external libraries needed.
Yes you can for that you have to use PyWin32
module which is a python module for windows ectension.
Take a look at its EmptyClipboard method.
The EmptyClipboard function empties the clipboard and frees handles to data in the clipboard. The function then assigns ownership of the clipboard to the window that currently has the clipboard open.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With