pygfx / wgpu-py

WebGPU for Python
https://wgpu-py.readthedocs.io
BSD 2-Clause "Simplified" License
411 stars 33 forks source link

Cursor image control #595

Closed hmaarrfk closed 2 hours ago

hmaarrfk commented 2 hours ago

I was removing some Qt-only code from our codebase and trying to replace it with wgpu/pygfx equivalents (for unifying Qt/JupyterRFB stuff) and I couldn't find a good replacement for setCursor

from qtpy.QtCore import Qt
canvas.setCursor(Qt.SizeBDiagCursor)

https://doc.qt.io/qt-6/qwidget.html#cursor-prop

thougths? ideas? maybe i'm missing something? I tried to search for "cursor" here but couldn't find anything.

Korijn commented 2 hours ago

There's no good way to abstract over such GUI differences. At this point it's just too specific. For the web you need to use CSS and HTML whereas for Qt you have the right method there. Just use those.

hmaarrfk commented 2 hours ago

got it, that makes sense that certain things are likely too hard.

Could PyGFX just take over the look the of the cursor when you are hovering over the canvas?

hmaarrfk commented 2 hours ago

I guess it would be up to my application have:

  1. Front end dependent code to hide the cursor using Qt/CSS/HTML
  2. PyGFX Scene cursor.
hmaarrfk commented 2 hours ago

Honestly, the interaction I had setup for it was likely weak and buggy anyway.

Touch interfaces don't have cursors, so it doesn't work for that.

Thanks for helping me brainstorm!!! (and the awesome stuff!)

Korijn commented 1 hour ago

You have a cursor within pygfx? That's pretty cool.

hmaarrfk commented 1 hour ago

You have a cursor within pygfx

not yet but i could...