-
-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add read_image
api to ui.clipboard
#4144
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pull request, @liunux4odoo!
- To be honest, I don't understand how to use this feature. How can I copy an image to the clipboard? Whatever I try, your demo says I need to copy an image first.
Apart from that, there are some problems with this implementation:
- We can't simply break existing API by renaming
read
andwrite
. I suggest to leave them unchanged while addingread_image
. - The demo doesn't work for two reasons:
- The call to
ui.clipboard.read_image()
needs to be awaited. - Awaiting a JavaScript command isn't allowed on the auto-index client, so the demo needs to be wrapped in a page function. But in order for the demo to keep working when embedded on the NiceGUI website, we need to prevent the decorator from adding a new route. Here is an example how to do that.
- The call to
I have reversed the |
Ok, I managed to copy an image like this:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again, @liunux4odoo!
I just improved the way PIL is imported because it is an optional dependency.
Let's merge!
make it easy to read copied image from client clipboard.