Pyloid Docs
GithubLanguage
  • 💎What is Pyloid?
  • Getting Started
    • Prerequisites
    • Create Pyloid App
  • Core Concepts
    • Thread Safety
  • API
    • Python (Backend)
      • Pyloid
      • BrowserWindow
      • Monitor
      • TrayEvent
      • Utility Functions
      • RPC
      • Store
    • Javascript (Frontend)
      • Event
      • BaseAPI
      • RPC
  • Guides
    • Load Webview
    • Serve Frontend
    • Calling Python from JS
    • Calling JS from Python
    • Keyboard Shotcuts
    • Notification
    • Tray
    • Timer
    • File Watcher
    • Clipboard
    • Window Position
    • Devtools
    • Window Drag Region
    • Window Radius And Transparent
    • Autostart
    • Production Utils
    • Desktop Monitor
    • File Dialog
    • Splash Screen
Powered by GitBook
On this page
  • Text Operations
  • Copying Text to Clipboard
  • Getting Text from Clipboard
  • Image Operations
  • Copying Image to Clipboard
  • Getting Image from Clipboard
  • Notes

Was this helpful?

Edit on GitHub
  1. Guides

Clipboard

Pyloid provides easy-to-use clipboard functionality. You can copy text and images to the clipboard or retrieve them from the clipboard.

Text Operations

Copying Text to Clipboard

app.set_clipboard_text("Text to be copied")

You can use this function to copy desired text to the clipboard.

Getting Text from Clipboard

text = app.get_clipboard_text()
print(text)

You can use this function to retrieve the text currently on the clipboard.

Image Operations

Copying Image to Clipboard

app.set_clipboard_image("assets/icon.png")

You can use this function to copy an image file to the clipboard. Just pass the file path as a string.

Getting Image from Clipboard

image = app.get_clipboard_image()
if image:
    print("Successfully retrieved the image.")
else:
    print("No image on the clipboard.")

You can use this function to retrieve the image currently on the clipboard. The returned image is of QImage type. If there's no image on the clipboard, it returns None.

With the QImage object, you can perform various operations such as image processing, display, saving, etc.

Notes

  • The set_clipboard_image function can accept not only image file paths but also byte data or os.PathLike objects.

  • The get_clipboard_image function returns a QImage object. You can use this for image processing, display, and other operations.

PreviousFile WatcherNextWindow Position

Last updated 6 months ago

Was this helpful?