Comments (16)
Just a cross-ref here that we should check if having our own RWI in #149 or moving to PySide6 (or PyQt6 eventually?) magically takes care of this issue.
from pyvistaqt.
I get the same thing on PyQt5 5.12:
And PyQt6:
This suggests that the rendering is still not HiDPI (it should be half the size, or the same size but 2x the resolution) :(
I also get this on mouseover:
>>> Traceback (most recent call last):
File "/Users/larsoner/python/pyvistaqt/pyvistaqt/rwi.py", line 571, in mouseMoveEvent
self.__saveX = ev.x()
AttributeError: 'QMouseEvent' object has no attribute 'x'
Abort trap: 6
... so I guess we have more work to do after #149 :)
from pyvistaqt.
... and FYI the upstream issue is https://gitlab.kitware.com/vtk/vtk/-/issues/17953. If we do manage to fix this by messing with rwi.py
, we should port the changes upstream to Kitware.
from pyvistaqt.
... since it works on Qt6, I'll close this as wontfix, same as in the upstream https://gitlab.kitware.com/vtk/vtk/-/issues/17953
from pyvistaqt.
Actually it looks like a lot of this should be handled by VTK already:
https://gitlab.kitware.com/vtk/vtk/-/merge_requests/4201/diffs
So I'm confused why it's not for BackgroundPlotter, but is for Plotter. Maybe we need to see if #25 helps by being explicit about parenting or something
from pyvistaqt.
... #25 does not help, but I still think it's useful for cleaning up inheritance
from pyvistaqt.
Actually I suspect the problem might be that BasePlotter and vtkRenderWindowInteractor will both create a RenderWindow (!). I think the solution might be to init BasePlotter first, then pass the self.ren_win it creates to vtkRenderWindowInteractor...
from pyvistaqt.
Okay that's not the problem :(
from pyvistaqt.
Okay I think this might actually be a VTK problem, since the EmbedPyQt example also has this problem:
import sys
import vtk
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QMainWindow, QFrame, QVBoxLayout
from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super().__init__(parent)
self.frame = QFrame(self)
self.vl = QVBoxLayout()
self.frame.setLayout(self.vl)
self.vtkWidget = QVTKRenderWindowInteractor(self.frame)
self.vl.addWidget(self.vtkWidget)
self.ren = vtk.vtkRenderer()
self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()
# Create source
source = vtk.vtkSphereSource()
source.SetCenter(0, 0, 0)
source.SetRadius(5.0)
# Create a mapper
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(source.GetOutputPort())
# Create an actor
actor = vtk.vtkActor()
actor.SetMapper(mapper)
self.ren.AddActor(actor)
self.ren.ResetCamera()
self.frame.setLayout(self.vl)
self.setCentralWidget(self.frame)
self.show()
self.iren.Initialize()
def resizeEvent(self, event):
super().resizeEvent(event)
print(event.size().width(), event.size().height())
ren_win = self.vtkWidget.GetRenderWindow()
print(ren_win.GetSize())
print(self.ren.GetSize())
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
sys.exit(app.exec_())
The interaction coordinates are wrong, and the rendering is not full-res. I wonder if we should make our own interactor class like Mayavi does...?
Also maybe I should check that embedding a Mayavi scene also works.
from pyvistaqt.
Okay filed an upstream bug:
https://gitlab.kitware.com/vtk/vtk/-/issues/17953
@banesullivan if you can try the two code snippets there on a HiDPI machine and comment over there that it's also a problem for you it might help.
from pyvistaqt.
(mayavi has the same problem, hence why I think it's essentially VTK's problem...)
from pyvistaqt.
Indeed it appears to be a VTK adapter problem, the workaround for now at my end is to use PyQt5 < 5.14
from pyvistaqt.
Just now looking at this. I can at least reproduce the issue on my laptop
from pyvistaqt.
Well this is encouraging:
Qt 6 supports high-DPI displays on all platforms, and will automatically account for the display resolution when using higher level APIs such as Qt Widgets or Qt Quick. Applications only need to provide high-resolution assets, such as images and icons. The feature is always enabled.
https://doc.qt.io/qt-6/portingguide.html#high-dpi
from pyvistaqt.
FYI @GuillaumeFavelier now that we roll our own QVTKRenderWindowInteractor, we can probably use EDIT: some ideas from #21 to try to fix this. I might take a look today to see if I can get anything sensible working
from pyvistaqt.
This seems to work fine on PySide6 at least, but still not PyQt5. Maybe we can just hope to move to full support for PySide6 (and PyQt6) and just not worry about this at some point...
from pyvistaqt.
Related Issues (20)
- only one of the subplots work on 4k monitor
- Online documentation not up to date HOT 1
- Lingering references prevent garbage collection
- Segmentation fault on Mac with PyQt5 HOT 2
- Race condition: BackgroundPlotter has no attribute named image HOT 3
- Running pyvistaqt project in Github Action HOT 2
- Inconsistent plotting results with PyVistaQT versus Jupyter (Trame) backends HOT 3
- Issue using pyvistaqt QtInteractor on Windows 10
- MAINT: Deploy docs HOT 7
- solicitud para agregar característica, para guardar los modelos en formato obj
- Stage release for PyVista 0.40 HOT 3
- Update GC testing fixture
- MAINT: Remove Azure
- Make the canvas background transparent HOT 1
- X Error of failed request: BadWindow (invalid Window parameter) HOT 3
- Border glitch during resize HOT 6
- macOS `pvqt.BackgroundPlotter` never opens window HOT 1
- DOC: MultiPlotter vs BackgroundPlotter
- no mouse interactivity with BackgroundPlotter HOT 1
- Consider adding `.git_archival.txt` to include version number in git archive
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyvistaqt.